2010-10-14 22:49:09 +00:00
|
|
|
/*
|
2010-12-07 20:11:25 +00:00
|
|
|
* Copyright (c) 2004-2006 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.
|
2015-06-09 14:42:35 -05:00
|
|
|
* Copyright (c) 2010-2015 Sandia National Laboratories. All rights reserved.
|
Per the PMIx RFC:
WHAT: Merge the PMIx branch into the devel repo, creating a new
OPAL “lmix” framework to abstract PMI support for all RTEs.
Replace the ORTE daemon-level collectives with a new PMIx
server and update the ORTE grpcomm framework to support
server-to-server collectives
WHY: We’ve had problems dealing with variations in PMI implementations,
and need to extend the existing PMI definitions to meet exascale
requirements.
WHEN: Mon, Aug 25
WHERE: https://github.com/rhc54/ompi-svn-mirror.git
Several community members have been working on a refactoring of the current PMI support within OMPI. Although the APIs are common, Slurm and Cray implement a different range of capabilities, and package them differently. For example, Cray provides an integrated PMI-1/2 library, while Slurm separates the two and requires the user to specify the one to be used at runtime. In addition, several bugs in the Slurm implementations have caused problems requiring extra coding.
All this has led to a slew of #if’s in the PMI code and bugs when the corner-case logic for one implementation accidentally traps the other. Extending this support to other implementations would have increased this complexity to an unacceptable level.
Accordingly, we have:
* created a new OPAL “pmix” framework to abstract the PMI support, with separate components for Cray, Slurm PMI-1, and Slurm PMI-2 implementations.
* Replaced the current ORTE grpcomm daemon-based collective operation with an integrated PMIx server, and updated the grpcomm APIs to provide more flexible, multi-algorithm support for collective operations. At this time, only the xcast and allgather operations are supported.
* Replaced the current global collective id with a signature based on the names of the participating procs. The allows an unlimited number of collectives to be executed by any group of processes, subject to the requirement that only one collective can be active at a time for a unique combination of procs. Note that a proc can be involved in any number of simultaneous collectives - it is the specific combination of procs that is subject to the constraint
* removed the prior OMPI/OPAL modex code
* added new macros for executing modex send/recv to simplify use of the new APIs. The send macros allow the caller to specify whether or not the BTL supports async modex operations - if so, then the non-blocking “fence” operation is used, if the active PMIx component supports it. Otherwise, the default is a full blocking modex exchange as we currently perform.
* retained the current flag that directs us to use a blocking fence operation, but only to retrieve data upon demand
This commit was SVN r32570.
2014-08-21 18:56:47 +00:00
|
|
|
* Copyright (c) 2014 Intel, Inc. All rights reserved.
|
2010-10-14 22:49:09 +00:00
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "ompi_config.h"
|
|
|
|
|
|
|
|
#include <portals4.h>
|
|
|
|
|
2015-09-24 19:19:06 -05:00
|
|
|
#include "ompi/communicator/communicator.h"
|
2011-06-01 17:20:18 +00:00
|
|
|
#include "ompi/proc/proc.h"
|
2010-10-14 22:49:09 +00:00
|
|
|
#include "ompi/mca/mtl/mtl.h"
|
2010-12-07 20:11:25 +00:00
|
|
|
#include "opal/class/opal_list.h"
|
Per the PMIx RFC:
WHAT: Merge the PMIx branch into the devel repo, creating a new
OPAL “lmix” framework to abstract PMI support for all RTEs.
Replace the ORTE daemon-level collectives with a new PMIx
server and update the ORTE grpcomm framework to support
server-to-server collectives
WHY: We’ve had problems dealing with variations in PMI implementations,
and need to extend the existing PMI definitions to meet exascale
requirements.
WHEN: Mon, Aug 25
WHERE: https://github.com/rhc54/ompi-svn-mirror.git
Several community members have been working on a refactoring of the current PMI support within OMPI. Although the APIs are common, Slurm and Cray implement a different range of capabilities, and package them differently. For example, Cray provides an integrated PMI-1/2 library, while Slurm separates the two and requires the user to specify the one to be used at runtime. In addition, several bugs in the Slurm implementations have caused problems requiring extra coding.
All this has led to a slew of #if’s in the PMI code and bugs when the corner-case logic for one implementation accidentally traps the other. Extending this support to other implementations would have increased this complexity to an unacceptable level.
Accordingly, we have:
* created a new OPAL “pmix” framework to abstract the PMI support, with separate components for Cray, Slurm PMI-1, and Slurm PMI-2 implementations.
* Replaced the current ORTE grpcomm daemon-based collective operation with an integrated PMIx server, and updated the grpcomm APIs to provide more flexible, multi-algorithm support for collective operations. At this time, only the xcast and allgather operations are supported.
* Replaced the current global collective id with a signature based on the names of the participating procs. The allows an unlimited number of collectives to be executed by any group of processes, subject to the requirement that only one collective can be active at a time for a unique combination of procs. Note that a proc can be involved in any number of simultaneous collectives - it is the specific combination of procs that is subject to the constraint
* removed the prior OMPI/OPAL modex code
* added new macros for executing modex send/recv to simplify use of the new APIs. The send macros allow the caller to specify whether or not the BTL supports async modex operations - if so, then the non-blocking “fence” operation is used, if the active PMIx component supports it. Otherwise, the default is a full blocking modex exchange as we currently perform.
* retained the current flag that directs us to use a blocking fence operation, but only to retrieve data upon demand
This commit was SVN r32570.
2014-08-21 18:56:47 +00:00
|
|
|
#include "opal/mca/pmix/pmix.h"
|
2010-10-14 22:49:09 +00:00
|
|
|
|
|
|
|
#include "mtl_portals4.h"
|
2010-12-07 20:11:25 +00:00
|
|
|
#include "mtl_portals4_recv_short.h"
|
2010-10-14 22:49:09 +00:00
|
|
|
|
2011-05-25 22:10:27 +00:00
|
|
|
extern mca_mtl_base_component_2_0_0_t mca_mtl_portals4_component;
|
|
|
|
|
2010-10-14 22:49:09 +00:00
|
|
|
mca_mtl_portals4_module_t ompi_mtl_portals4 = {
|
|
|
|
{
|
|
|
|
8191, /* max cid - 2^13 - 1 */
|
|
|
|
(1UL << 30), /* max tag value - must allow negatives */
|
|
|
|
0, /* request reserve space */
|
|
|
|
0, /* flags */
|
|
|
|
|
|
|
|
ompi_mtl_portals4_add_procs,
|
|
|
|
ompi_mtl_portals4_del_procs,
|
|
|
|
ompi_mtl_portals4_finalize,
|
|
|
|
|
2012-03-26 19:19:11 +00:00
|
|
|
ompi_mtl_portals4_send,
|
2010-10-14 22:49:09 +00:00
|
|
|
ompi_mtl_portals4_isend,
|
|
|
|
ompi_mtl_portals4_irecv,
|
|
|
|
ompi_mtl_portals4_iprobe,
|
2012-03-22 22:55:59 +00:00
|
|
|
ompi_mtl_portals4_imrecv,
|
|
|
|
ompi_mtl_portals4_improbe,
|
2010-10-14 22:49:09 +00:00
|
|
|
|
2011-11-11 02:49:03 +00:00
|
|
|
ompi_mtl_portals4_cancel,
|
2012-03-22 22:55:59 +00:00
|
|
|
ompi_mtl_portals4_add_comm,
|
|
|
|
ompi_mtl_portals4_del_comm
|
2010-10-14 22:49:09 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2015-04-14 09:48:07 -05:00
|
|
|
static int
|
|
|
|
portals4_init_interface(void)
|
|
|
|
{
|
|
|
|
unsigned int ret;
|
|
|
|
ptl_md_t md;
|
|
|
|
ptl_me_t me;
|
|
|
|
|
|
|
|
/* create event queues */
|
|
|
|
ret = PtlEQAlloc(ompi_mtl_portals4.ni_h,
|
|
|
|
ompi_mtl_portals4.send_queue_size,
|
|
|
|
&ompi_mtl_portals4.send_eq_h);
|
|
|
|
if (PTL_OK != ret) {
|
|
|
|
opal_output_verbose(1, ompi_mtl_base_framework.framework_output,
|
|
|
|
"%s:%d: PtlEQAlloc failed: %d\n",
|
|
|
|
__FILE__, __LINE__, ret);
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
ret = PtlEQAlloc(ompi_mtl_portals4.ni_h,
|
|
|
|
ompi_mtl_portals4.recv_queue_size,
|
|
|
|
&ompi_mtl_portals4.recv_eq_h);
|
|
|
|
if (PTL_OK != ret) {
|
|
|
|
opal_output_verbose(1, ompi_mtl_base_framework.framework_output,
|
|
|
|
"%s:%d: PtlEQAlloc failed: %d\n",
|
|
|
|
__FILE__, __LINE__, ret);
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Create send and long message (read) portal table entries */
|
|
|
|
ret = PtlPTAlloc(ompi_mtl_portals4.ni_h,
|
2015-06-23 20:59:57 -07:00
|
|
|
PTL_PT_ONLY_USE_ONCE |
|
|
|
|
PTL_PT_ONLY_TRUNCATE |
|
2015-04-14 09:48:07 -05:00
|
|
|
PTL_PT_FLOWCTRL,
|
|
|
|
ompi_mtl_portals4.recv_eq_h,
|
|
|
|
REQ_RECV_TABLE_ID,
|
|
|
|
&ompi_mtl_portals4.recv_idx);
|
|
|
|
if (PTL_OK != ret) {
|
|
|
|
opal_output_verbose(1, ompi_mtl_base_framework.framework_output,
|
|
|
|
"%s:%d: PtlPTAlloc failed: %d\n",
|
|
|
|
__FILE__, __LINE__, ret);
|
|
|
|
goto error;
|
|
|
|
}
|
2015-06-09 14:42:35 -05:00
|
|
|
if (ompi_mtl_portals4.recv_idx != REQ_RECV_TABLE_ID) {
|
|
|
|
opal_output_verbose(1, ompi_mtl_base_framework.framework_output,
|
|
|
|
"%s:%d: PtlPTAlloc did not allocate the requested PT: %d\n",
|
|
|
|
__FILE__, __LINE__, ompi_mtl_portals4.recv_idx);
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
|
2015-04-14 09:48:07 -05:00
|
|
|
ret = PtlPTAlloc(ompi_mtl_portals4.ni_h,
|
|
|
|
PTL_PT_ONLY_USE_ONCE |
|
|
|
|
PTL_PT_ONLY_TRUNCATE,
|
|
|
|
ompi_mtl_portals4.send_eq_h,
|
|
|
|
REQ_READ_TABLE_ID,
|
|
|
|
&ompi_mtl_portals4.read_idx);
|
|
|
|
if (PTL_OK != ret) {
|
|
|
|
opal_output_verbose(1, ompi_mtl_base_framework.framework_output,
|
|
|
|
"%s:%d: PtlPTAlloc failed: %d\n",
|
|
|
|
__FILE__, __LINE__, ret);
|
|
|
|
goto error;
|
|
|
|
}
|
2015-06-09 14:42:35 -05:00
|
|
|
if (ompi_mtl_portals4.read_idx != REQ_READ_TABLE_ID) {
|
|
|
|
opal_output_verbose(1, ompi_mtl_base_framework.framework_output,
|
|
|
|
"%s:%d: PtlPTAlloc did not allocate the requested PT: %d\n",
|
|
|
|
__FILE__, __LINE__, ompi_mtl_portals4.read_idx);
|
|
|
|
goto error;
|
|
|
|
}
|
2015-04-14 09:48:07 -05:00
|
|
|
|
|
|
|
/* bind zero-length md for sending acks */
|
|
|
|
md.start = NULL;
|
|
|
|
md.length = 0;
|
|
|
|
md.options = 0;
|
|
|
|
md.eq_handle = PTL_EQ_NONE;
|
|
|
|
md.ct_handle = PTL_CT_NONE;
|
|
|
|
|
|
|
|
ret = PtlMDBind(ompi_mtl_portals4.ni_h,
|
|
|
|
&md,
|
2015-06-23 20:59:57 -07:00
|
|
|
&ompi_mtl_portals4.zero_md_h);
|
2015-04-14 09:48:07 -05:00
|
|
|
if (PTL_OK != ret) {
|
|
|
|
opal_output_verbose(1, ompi_mtl_base_framework.framework_output,
|
|
|
|
"%s:%d: PtlMDBind failed: %d\n",
|
|
|
|
__FILE__, __LINE__, ret);
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
|
2015-05-11 11:25:57 -05:00
|
|
|
/* Bind MD across all memory */
|
|
|
|
md.start = 0;
|
|
|
|
md.length = PTL_SIZE_MAX;
|
|
|
|
md.options = 0;
|
|
|
|
md.eq_handle = ompi_mtl_portals4.send_eq_h;
|
|
|
|
md.ct_handle = PTL_CT_NONE;
|
2015-04-14 09:48:07 -05:00
|
|
|
|
2015-05-11 11:25:57 -05:00
|
|
|
ret = PtlMDBind(ompi_mtl_portals4.ni_h,
|
|
|
|
&md,
|
|
|
|
&ompi_mtl_portals4.send_md_h);
|
|
|
|
if (PTL_OK != ret) {
|
|
|
|
opal_output_verbose(1, ompi_mtl_base_framework.framework_output,
|
|
|
|
"%s:%d: PtlMDBind failed: %d\n",
|
|
|
|
__FILE__, __LINE__, ret);
|
|
|
|
goto error;
|
2015-04-14 09:48:07 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Handle long overflows */
|
|
|
|
me.start = NULL;
|
|
|
|
me.length = 0;
|
|
|
|
me.ct_handle = PTL_CT_NONE;
|
|
|
|
me.min_free = 0;
|
|
|
|
me.uid = ompi_mtl_portals4.uid;
|
2015-06-23 20:59:57 -07:00
|
|
|
me.options = PTL_ME_OP_PUT |
|
2015-04-14 09:48:07 -05:00
|
|
|
PTL_ME_EVENT_LINK_DISABLE |
|
2015-06-23 20:59:57 -07:00
|
|
|
PTL_ME_EVENT_COMM_DISABLE |
|
2015-04-14 09:48:07 -05:00
|
|
|
PTL_ME_EVENT_UNLINK_DISABLE;
|
|
|
|
if (ompi_mtl_portals4.use_logical) {
|
|
|
|
me.match_id.rank = PTL_RANK_ANY;
|
|
|
|
} else {
|
|
|
|
me.match_id.phys.nid = PTL_NID_ANY;
|
|
|
|
me.match_id.phys.pid = PTL_PID_ANY;
|
|
|
|
}
|
|
|
|
me.match_bits = MTL_PORTALS4_LONG_MSG;
|
2015-06-23 20:59:57 -07:00
|
|
|
me.ignore_bits = MTL_PORTALS4_CONTEXT_MASK |
|
|
|
|
MTL_PORTALS4_SOURCE_MASK |
|
2015-04-14 09:48:07 -05:00
|
|
|
MTL_PORTALS4_TAG_MASK;
|
2015-11-09 17:04:26 +01:00
|
|
|
|
2015-04-14 09:48:07 -05:00
|
|
|
ret = PtlMEAppend(ompi_mtl_portals4.ni_h,
|
|
|
|
ompi_mtl_portals4.recv_idx,
|
|
|
|
&me,
|
|
|
|
PTL_OVERFLOW_LIST,
|
|
|
|
NULL,
|
|
|
|
&ompi_mtl_portals4.long_overflow_me_h);
|
|
|
|
if (PTL_OK != ret) {
|
|
|
|
opal_output_verbose(1, ompi_mtl_base_framework.framework_output,
|
|
|
|
"%s:%d: PtlMEAppend failed: %d\n",
|
|
|
|
__FILE__, __LINE__, ret);
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* attach short unex recv blocks */
|
|
|
|
ret = ompi_mtl_portals4_recv_short_init();
|
|
|
|
if (OMPI_SUCCESS != ret) {
|
|
|
|
opal_output_verbose(1, ompi_mtl_base_framework.framework_output,
|
|
|
|
"%s:%d: short receive block initialization failed: %d\n",
|
|
|
|
__FILE__, __LINE__, ret);
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
|
|
|
|
ompi_mtl_portals4.opcount = 0;
|
|
|
|
#if OPAL_ENABLE_DEBUG
|
|
|
|
ompi_mtl_portals4.recv_opcount = 0;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if OMPI_MTL_PORTALS4_FLOW_CONTROL
|
|
|
|
ret = ompi_mtl_portals4_flowctl_init();
|
|
|
|
if (OMPI_SUCCESS != ret) {
|
|
|
|
opal_output_verbose(1, ompi_mtl_base_framework.framework_output,
|
|
|
|
"%s:%d: ompi_mtl_portals4_flowctl_init failed: %d\n",
|
|
|
|
__FILE__, __LINE__, ret);
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2015-04-16 08:10:29 -05:00
|
|
|
return OMPI_SUCCESS;
|
|
|
|
|
2015-04-14 09:48:07 -05:00
|
|
|
error:
|
|
|
|
if (!PtlHandleIsEqual(ompi_mtl_portals4.long_overflow_me_h, PTL_INVALID_HANDLE)) {
|
|
|
|
PtlMEUnlink(ompi_mtl_portals4.long_overflow_me_h);
|
|
|
|
}
|
|
|
|
if (!PtlHandleIsEqual(ompi_mtl_portals4.zero_md_h, PTL_INVALID_HANDLE)) {
|
|
|
|
PtlMDRelease(ompi_mtl_portals4.zero_md_h);
|
|
|
|
}
|
|
|
|
if (!PtlHandleIsEqual(ompi_mtl_portals4.send_md_h, PTL_INVALID_HANDLE)) {
|
|
|
|
PtlMDRelease(ompi_mtl_portals4.send_md_h);
|
|
|
|
}
|
|
|
|
if (ompi_mtl_portals4.read_idx != (ptl_pt_index_t) ~0UL) {
|
|
|
|
PtlPTFree(ompi_mtl_portals4.ni_h, ompi_mtl_portals4.read_idx);
|
|
|
|
}
|
|
|
|
if (ompi_mtl_portals4.recv_idx != (ptl_pt_index_t) ~0UL) {
|
|
|
|
PtlPTFree(ompi_mtl_portals4.ni_h, ompi_mtl_portals4.recv_idx);
|
|
|
|
}
|
|
|
|
if (!PtlHandleIsEqual(ompi_mtl_portals4.send_eq_h, PTL_INVALID_HANDLE)) {
|
|
|
|
PtlEQFree(ompi_mtl_portals4.send_eq_h);
|
|
|
|
}
|
|
|
|
if (!PtlHandleIsEqual(ompi_mtl_portals4.recv_eq_h, PTL_INVALID_HANDLE)) {
|
|
|
|
PtlEQFree(ompi_mtl_portals4.recv_eq_h);
|
|
|
|
}
|
|
|
|
return OMPI_ERROR;
|
|
|
|
}
|
2010-10-14 22:49:09 +00:00
|
|
|
|
2015-09-24 19:19:06 -05:00
|
|
|
static int
|
|
|
|
create_maptable(size_t nprocs,
|
|
|
|
ompi_proc_t **procs)
|
2010-10-14 22:49:09 +00:00
|
|
|
{
|
2015-09-24 19:19:06 -05:00
|
|
|
int ret;
|
2010-12-07 20:11:25 +00:00
|
|
|
size_t i;
|
2015-04-14 09:48:07 -05:00
|
|
|
ptl_process_t *maptable;
|
|
|
|
|
2015-09-24 19:19:06 -05:00
|
|
|
maptable = malloc(sizeof(ptl_process_t) * nprocs);
|
|
|
|
if (NULL == maptable) {
|
|
|
|
opal_output_verbose(1, ompi_mtl_base_framework.framework_output,
|
|
|
|
"%s:%d: malloc failed\n",
|
|
|
|
__FILE__, __LINE__);
|
|
|
|
return OMPI_ERR_OUT_OF_RESOURCE;
|
2015-04-14 09:48:07 -05:00
|
|
|
}
|
2010-12-07 20:11:25 +00:00
|
|
|
|
2015-09-24 19:19:06 -05:00
|
|
|
for (i=0;i<nprocs;i++) {
|
2013-08-30 16:54:55 +00:00
|
|
|
ptl_process_t *modex_id;
|
2011-05-25 22:10:27 +00:00
|
|
|
size_t size;
|
|
|
|
|
2014-08-25 16:30:26 +00:00
|
|
|
OPAL_MODEX_RECV(ret, &mca_mtl_portals4_component.mtl_version,
|
2015-06-18 09:53:20 -07:00
|
|
|
&procs[i]->super.proc_name, (uint8_t**)&modex_id, &size);
|
2011-05-25 22:10:27 +00:00
|
|
|
if (OMPI_SUCCESS != ret) {
|
2013-03-27 21:17:31 +00:00
|
|
|
opal_output_verbose(1, ompi_mtl_base_framework.framework_output,
|
2011-09-29 22:26:33 +00:00
|
|
|
"%s:%d: ompi_modex_recv failed: %d\n",
|
|
|
|
__FILE__, __LINE__, ret);
|
2011-05-25 22:10:27 +00:00
|
|
|
return ret;
|
|
|
|
} else if (sizeof(ptl_process_t) != size) {
|
2013-03-27 21:17:31 +00:00
|
|
|
opal_output_verbose(1, ompi_mtl_base_framework.framework_output,
|
2011-09-29 22:26:33 +00:00
|
|
|
"%s:%d: ompi_modex_recv failed: %d\n",
|
|
|
|
__FILE__, __LINE__, ret);
|
2011-06-13 15:18:55 +00:00
|
|
|
return OMPI_ERR_BAD_PARAM;
|
2011-05-25 22:10:27 +00:00
|
|
|
}
|
2013-08-30 16:54:55 +00:00
|
|
|
|
2015-09-24 19:19:06 -05:00
|
|
|
maptable[i].phys.pid = modex_id->phys.pid;
|
|
|
|
maptable[i].phys.nid = modex_id->phys.nid;
|
|
|
|
opal_output_verbose(50, ompi_mtl_base_framework.framework_output,
|
2015-12-15 13:38:49 -06:00
|
|
|
"logical: global rank=%d pid=%x nid=%x\n",
|
2015-09-24 19:19:06 -05:00
|
|
|
(int)i, maptable[i].phys.pid, maptable[i].phys.nid);
|
|
|
|
}
|
|
|
|
|
|
|
|
ret = PtlSetMap(ompi_mtl_portals4.ni_h, nprocs, maptable);
|
|
|
|
if (OMPI_SUCCESS != ret) {
|
|
|
|
opal_output_verbose(1, ompi_mtl_base_framework.framework_output,
|
|
|
|
"%s:%d: logical mapping failed: %d\n",
|
|
|
|
__FILE__, __LINE__, ret);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
opal_output_verbose(1, ompi_mtl_base_framework.framework_output,
|
|
|
|
"logical mapping OK\n");
|
|
|
|
|
|
|
|
free(maptable);
|
|
|
|
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
create_endpoint(ompi_proc_t *proc)
|
|
|
|
{
|
|
|
|
ptl_process_t *endpoint;
|
|
|
|
|
|
|
|
endpoint = malloc(sizeof(ptl_process_t));
|
|
|
|
if (NULL == endpoint) {
|
|
|
|
opal_output_verbose(1, ompi_mtl_base_framework.framework_output,
|
|
|
|
"%s:%d: malloc failed: %s\n",
|
|
|
|
__FILE__, __LINE__, strerror(errno));
|
|
|
|
return OMPI_ERR_OUT_OF_RESOURCE;
|
|
|
|
} else {
|
|
|
|
if (ompi_mtl_portals4.use_logical) {
|
2015-12-15 13:38:49 -06:00
|
|
|
endpoint->phys.nid = 0;
|
|
|
|
endpoint->phys.pid = 0;
|
2015-09-24 19:19:06 -05:00
|
|
|
endpoint->rank = proc->super.proc_name.vpid;
|
|
|
|
} else {
|
|
|
|
int ret;
|
|
|
|
ptl_process_t *modex_id;
|
|
|
|
size_t size;
|
|
|
|
|
|
|
|
OPAL_MODEX_RECV(ret, &mca_mtl_portals4_component.mtl_version,
|
|
|
|
&proc->super.proc_name, (uint8_t**)&modex_id, &size);
|
|
|
|
if (OMPI_SUCCESS != ret) {
|
|
|
|
opal_output_verbose(1, ompi_mtl_base_framework.framework_output,
|
|
|
|
"%s:%d: ompi_modex_recv failed: %d\n",
|
|
|
|
__FILE__, __LINE__, ret);
|
|
|
|
return ret;
|
|
|
|
} else if (sizeof(ptl_process_t) != size) {
|
2013-08-30 16:54:55 +00:00
|
|
|
opal_output_verbose(1, ompi_mtl_base_framework.framework_output,
|
2015-09-24 19:19:06 -05:00
|
|
|
"%s:%d: ompi_modex_recv failed (size mismatch): %d\n",
|
2013-08-30 16:54:55 +00:00
|
|
|
__FILE__, __LINE__, ret);
|
2015-09-24 19:19:06 -05:00
|
|
|
return OMPI_ERR_BAD_PARAM;
|
2013-08-30 16:54:55 +00:00
|
|
|
}
|
2015-09-24 19:19:06 -05:00
|
|
|
|
|
|
|
*endpoint = *modex_id;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
proc->proc_endpoints[OMPI_PROC_ENDPOINT_TAG_PORTALS4] = endpoint;
|
|
|
|
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
ompi_proc_t *
|
|
|
|
ompi_mtl_portals4_get_proc_group(struct ompi_group_t *group, int rank)
|
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
ompi_proc_t *proc = ompi_group_peer_lookup (group, rank);
|
|
|
|
if (NULL == proc->proc_endpoints[OMPI_PROC_ENDPOINT_TAG_PORTALS4]) {
|
|
|
|
ret = create_endpoint(proc);
|
|
|
|
if (OMPI_SUCCESS != ret) {
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
#if 0
|
|
|
|
} else {
|
|
|
|
/*
|
|
|
|
* sanity check
|
|
|
|
*/
|
|
|
|
int ret;
|
|
|
|
ptl_process_t *modex_id;
|
|
|
|
size_t size;
|
|
|
|
|
|
|
|
OPAL_MODEX_RECV(ret, &mca_mtl_portals4_component.mtl_version,
|
|
|
|
&proc->super.proc_name, (uint8_t**)&modex_id, &size);
|
|
|
|
|
|
|
|
ptl_process_t *peer = (ptl_process_t*) proc->proc_endpoints[OMPI_PROC_ENDPOINT_TAG_PORTALS4];
|
|
|
|
if (ompi_mtl_portals4.use_logical) {
|
|
|
|
if ((size_t)peer->rank != proc->super.proc_name.vpid) {
|
|
|
|
opal_output_verbose(1, ompi_mtl_base_framework.framework_output,
|
|
|
|
"%s:%d: existing peer and rank don't match\n",
|
|
|
|
__FILE__, __LINE__);
|
|
|
|
return OMPI_ERROR;
|
2015-04-14 09:48:07 -05:00
|
|
|
}
|
2015-09-24 19:19:06 -05:00
|
|
|
}
|
|
|
|
else if (peer->phys.nid != modex_id->phys.nid ||
|
|
|
|
peer->phys.pid != modex_id->phys.pid) {
|
|
|
|
opal_output_verbose(1, ompi_mtl_base_framework.framework_output,
|
|
|
|
"%s:%d: existing peer and modex peer don't match\n",
|
|
|
|
__FILE__, __LINE__);
|
|
|
|
return OMPI_ERROR;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
2015-04-14 09:48:07 -05:00
|
|
|
|
2015-09-24 19:19:06 -05:00
|
|
|
return proc;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
add_endpoints(size_t nprocs,
|
|
|
|
ompi_proc_t **procs)
|
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
size_t i;
|
2014-01-02 22:37:01 +00:00
|
|
|
|
2015-09-24 19:19:06 -05:00
|
|
|
/* Get the list of ptl_process_id_t from the runtime and copy into structure */
|
|
|
|
for (i = 0 ; i < nprocs ; ++i) {
|
|
|
|
if (procs[i]->super.proc_arch != ompi_proc_local()->super.proc_arch) {
|
|
|
|
opal_output_verbose(1, ompi_mtl_base_framework.framework_output,
|
|
|
|
"Portals 4 MTL does not support heterogeneous operations.");
|
|
|
|
opal_output_verbose(1, ompi_mtl_base_framework.framework_output,
|
|
|
|
"Proc %s architecture %x, mine %x.",
|
|
|
|
OMPI_NAME_PRINT(&procs[i]->super.proc_name),
|
|
|
|
procs[i]->super.proc_arch, ompi_proc_local()->super.proc_arch);
|
|
|
|
return OMPI_ERR_NOT_SUPPORTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (NULL == procs[i]->proc_endpoints[OMPI_PROC_ENDPOINT_TAG_PORTALS4]) {
|
|
|
|
ret = create_endpoint(procs[i]);
|
|
|
|
if (OMPI_SUCCESS != ret) {
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
#if 0
|
2013-08-30 16:54:55 +00:00
|
|
|
} else {
|
2015-09-24 19:19:06 -05:00
|
|
|
/*
|
|
|
|
* sanity check
|
|
|
|
*/
|
|
|
|
int ret;
|
|
|
|
ptl_process_t *modex_id;
|
|
|
|
size_t size;
|
|
|
|
|
|
|
|
OPAL_MODEX_RECV(ret, &mca_mtl_portals4_component.mtl_version,
|
|
|
|
&procs[i]->super.proc_name, (uint8_t**)&modex_id, &size);
|
|
|
|
|
2013-08-30 16:54:55 +00:00
|
|
|
ptl_process_t *proc = (ptl_process_t*) procs[i]->proc_endpoints[OMPI_PROC_ENDPOINT_TAG_PORTALS4];
|
2015-04-14 09:48:07 -05:00
|
|
|
if (ompi_mtl_portals4.use_logical) {
|
2015-09-24 19:19:06 -05:00
|
|
|
if ((size_t)proc->rank != procs[i]->super.proc_name.vpid) {
|
2015-04-14 09:48:07 -05:00
|
|
|
opal_output_verbose(1, ompi_mtl_base_framework.framework_output,
|
|
|
|
"%s:%d: existing peer and rank don't match\n",
|
|
|
|
__FILE__, __LINE__);
|
|
|
|
return OMPI_ERROR;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (proc->phys.nid != modex_id->phys.nid ||
|
|
|
|
proc->phys.pid != modex_id->phys.pid) {
|
2013-08-30 16:54:55 +00:00
|
|
|
opal_output_verbose(1, ompi_mtl_base_framework.framework_output,
|
|
|
|
"%s:%d: existing peer and modex peer don't match\n",
|
|
|
|
__FILE__, __LINE__);
|
|
|
|
return OMPI_ERROR;
|
|
|
|
}
|
2015-09-24 19:19:06 -05:00
|
|
|
#endif
|
2013-08-30 16:54:55 +00:00
|
|
|
}
|
2010-10-14 22:49:09 +00:00
|
|
|
}
|
|
|
|
|
2015-09-24 19:19:06 -05:00
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
2015-04-14 09:48:07 -05:00
|
|
|
|
2015-09-24 19:19:06 -05:00
|
|
|
#define NEED_ALL_PROCS (ompi_mtl_portals4.use_logical || ompi_mtl_portals4.use_flowctl)
|
2015-04-14 09:48:07 -05:00
|
|
|
|
2015-09-24 19:19:06 -05:00
|
|
|
int
|
|
|
|
ompi_mtl_portals4_add_procs(struct mca_mtl_base_module_t *mtl,
|
|
|
|
size_t nprocs,
|
|
|
|
struct ompi_proc_t** procs)
|
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* The PML handed us a list of procs that need Portals4
|
|
|
|
* peer info. Complete those procs here.
|
|
|
|
*/
|
|
|
|
ret = add_endpoints(nprocs,
|
|
|
|
procs);
|
2015-04-14 09:48:07 -05:00
|
|
|
if (OMPI_SUCCESS != ret) {
|
|
|
|
opal_output_verbose(1, ompi_mtl_base_framework.framework_output,
|
2015-09-24 19:19:06 -05:00
|
|
|
"%s:%d: add_endpoints failed: %d\n",
|
2015-04-14 09:48:07 -05:00
|
|
|
__FILE__, __LINE__, ret);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2015-09-24 19:19:06 -05:00
|
|
|
if (1 == ompi_mtl_portals4.need_init) {
|
|
|
|
if (1 == ompi_mtl_portals4.use_logical) {
|
|
|
|
ret = create_maptable(nprocs, procs);
|
|
|
|
if (OMPI_SUCCESS != ret) {
|
|
|
|
opal_output_verbose(1, ompi_mtl_base_framework.framework_output,
|
|
|
|
"%s:%d: ompi_mtl_portals4_add_procs::create_maptable() failed: %d\n",
|
|
|
|
__FILE__, __LINE__, ret);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This is the first time through here. Initialize
|
|
|
|
* Portals4 and register the progress thread.
|
|
|
|
*/
|
|
|
|
portals4_init_interface();
|
|
|
|
|
|
|
|
/* activate progress callback */
|
|
|
|
ret = opal_progress_register(ompi_mtl_portals4_progress);
|
|
|
|
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);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2012-03-26 01:31:58 +00:00
|
|
|
#if OMPI_MTL_PORTALS4_FLOW_CONTROL
|
2015-09-24 19:19:06 -05:00
|
|
|
opal_output_verbose(50, ompi_mtl_base_framework.framework_output,
|
|
|
|
"add_procs() - me=%d\n", ompi_proc_local_proc->super.proc_name.vpid);
|
|
|
|
|
|
|
|
opal_output_verbose(50, ompi_mtl_base_framework.framework_output,
|
|
|
|
"add_procs() - adding flowctl procs\n");
|
|
|
|
|
|
|
|
ret = ompi_mtl_portals4_flowctl_add_procs(ompi_proc_local_proc->super.proc_name.vpid,
|
|
|
|
nprocs,
|
|
|
|
procs);
|
2014-01-02 22:37:01 +00:00
|
|
|
if (OMPI_SUCCESS != ret) {
|
|
|
|
opal_output_verbose(1, ompi_mtl_base_framework.framework_output,
|
|
|
|
"%s:%d: flowctl_add_procs failed: %d\n",
|
|
|
|
__FILE__, __LINE__, ret);
|
|
|
|
return ret;
|
|
|
|
}
|
2012-03-26 01:31:58 +00:00
|
|
|
#endif
|
|
|
|
|
2015-09-24 19:19:06 -05:00
|
|
|
ompi_mtl_portals4.need_init = 0;
|
|
|
|
}
|
|
|
|
|
2010-10-14 22:49:09 +00:00
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
ompi_mtl_portals4_del_procs(struct mca_mtl_base_module_t *mtl,
|
2010-12-07 20:11:25 +00:00
|
|
|
size_t nprocs,
|
2015-06-23 20:59:57 -07:00
|
|
|
struct ompi_proc_t** procs)
|
2010-10-14 22:49:09 +00:00
|
|
|
{
|
2010-12-07 20:11:25 +00:00
|
|
|
size_t i;
|
|
|
|
|
2015-09-24 19:19:06 -05:00
|
|
|
opal_output_verbose(50, ompi_mtl_base_framework.framework_output,
|
|
|
|
"del_procs() - enter\n");
|
|
|
|
|
2010-12-07 20:11:25 +00:00
|
|
|
for (i = 0 ; i < nprocs ; ++i) {
|
2013-08-30 16:54:55 +00:00
|
|
|
if (NULL != procs[i]->proc_endpoints[OMPI_PROC_ENDPOINT_TAG_PORTALS4]) {
|
|
|
|
free(procs[i]->proc_endpoints[OMPI_PROC_ENDPOINT_TAG_PORTALS4]);
|
|
|
|
procs[i]->proc_endpoints[OMPI_PROC_ENDPOINT_TAG_PORTALS4] = NULL;
|
2010-12-07 20:11:25 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-09-24 19:19:06 -05:00
|
|
|
opal_output_verbose(50, ompi_mtl_base_framework.framework_output,
|
|
|
|
"del_procs() - exit\n");
|
|
|
|
|
2010-10-14 22:49:09 +00:00
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
ompi_mtl_portals4_finalize(struct mca_mtl_base_module_t *mtl)
|
|
|
|
{
|
2010-12-07 20:11:25 +00:00
|
|
|
opal_progress_unregister(ompi_mtl_portals4_progress);
|
|
|
|
while (0 != ompi_mtl_portals4_progress()) { }
|
|
|
|
|
2012-03-26 01:31:58 +00:00
|
|
|
#if OMPI_MTL_PORTALS4_FLOW_CONTROL
|
|
|
|
ompi_mtl_portals4_flowctl_fini();
|
|
|
|
#endif
|
2012-03-21 22:20:55 +00:00
|
|
|
ompi_mtl_portals4_recv_short_fini();
|
2011-06-13 15:18:55 +00:00
|
|
|
|
2015-10-22 12:35:39 -05:00
|
|
|
if (!PtlHandleIsEqual(ompi_mtl_portals4.long_overflow_me_h, PTL_INVALID_HANDLE)) {
|
|
|
|
PtlMEUnlink(ompi_mtl_portals4.long_overflow_me_h);
|
|
|
|
}
|
|
|
|
if (!PtlHandleIsEqual(ompi_mtl_portals4.zero_md_h, PTL_INVALID_HANDLE)) {
|
|
|
|
PtlMDRelease(ompi_mtl_portals4.zero_md_h);
|
|
|
|
}
|
|
|
|
if (!PtlHandleIsEqual(ompi_mtl_portals4.send_md_h, PTL_INVALID_HANDLE)) {
|
|
|
|
PtlMDRelease(ompi_mtl_portals4.send_md_h);
|
|
|
|
}
|
|
|
|
if (ompi_mtl_portals4.read_idx != (ptl_pt_index_t) ~0UL) {
|
|
|
|
PtlPTFree(ompi_mtl_portals4.ni_h, ompi_mtl_portals4.read_idx);
|
|
|
|
}
|
|
|
|
if (ompi_mtl_portals4.recv_idx != (ptl_pt_index_t) ~0UL) {
|
|
|
|
PtlPTFree(ompi_mtl_portals4.ni_h, ompi_mtl_portals4.recv_idx);
|
|
|
|
}
|
|
|
|
if (!PtlHandleIsEqual(ompi_mtl_portals4.send_eq_h, PTL_INVALID_HANDLE)) {
|
|
|
|
PtlEQFree(ompi_mtl_portals4.send_eq_h);
|
|
|
|
}
|
|
|
|
if (!PtlHandleIsEqual(ompi_mtl_portals4.recv_eq_h, PTL_INVALID_HANDLE)) {
|
|
|
|
PtlEQFree(ompi_mtl_portals4.recv_eq_h);
|
|
|
|
}
|
|
|
|
if (!PtlHandleIsEqual(ompi_mtl_portals4.ni_h, PTL_INVALID_HANDLE)) {
|
|
|
|
PtlNIFini(ompi_mtl_portals4.ni_h);
|
|
|
|
}
|
|
|
|
|
2010-10-14 22:49:09 +00:00
|
|
|
PtlFini();
|
|
|
|
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
2010-12-07 20:11:25 +00:00
|
|
|
|
2012-03-21 22:20:55 +00:00
|
|
|
|
2012-03-22 22:55:59 +00:00
|
|
|
int
|
|
|
|
ompi_mtl_portals4_add_comm(struct mca_mtl_base_module_t *mtl,
|
|
|
|
struct ompi_communicator_t *comm)
|
|
|
|
{
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
ompi_mtl_portals4_del_comm(struct mca_mtl_base_module_t *mtl,
|
|
|
|
struct ompi_communicator_t *comm)
|
|
|
|
{
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|