2011-12-09 21:24:07 +00:00
|
|
|
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
|
|
|
|
/*
|
2017-03-12 22:37:35 -06:00
|
|
|
* Copyright (c) 2011-2017 Los Alamos National Security, LLC. All rights
|
2011-12-09 21:24:07 +00:00
|
|
|
* reserved.
|
2013-07-04 08:34:37 +00:00
|
|
|
* Copyright (c) 2011-2013 UT-Battelle, LLC. All rights reserved.
|
2017-03-24 13:37:11 -06:00
|
|
|
* Copyright (c) 2017 Intel, Inc. All rights reserved.
|
2011-12-09 21:24:07 +00:00
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "btl_ugni_endpoint.h"
|
2012-02-10 00:47:29 +00:00
|
|
|
#include "btl_ugni_smsg.h"
|
2017-03-12 22:37:35 -06:00
|
|
|
#include "opal/mca/pmix/pmix.h"
|
2011-12-09 21:24:07 +00:00
|
|
|
|
|
|
|
static void mca_btl_ugni_ep_construct (mca_btl_base_endpoint_t *ep)
|
|
|
|
{
|
2012-04-19 21:51:55 +00:00
|
|
|
memset ((char *) ep + sizeof(ep->super), 0, sizeof (*ep) - sizeof (ep->super));
|
2012-05-31 20:02:41 +00:00
|
|
|
OBJ_CONSTRUCT(&ep->frag_wait_list, opal_list_t);
|
2016-08-24 10:36:08 -06:00
|
|
|
OBJ_CONSTRUCT(&ep->lock, opal_recursive_mutex_t);
|
2011-12-09 21:24:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void mca_btl_ugni_ep_destruct (mca_btl_base_endpoint_t *ep)
|
|
|
|
{
|
2012-05-31 20:02:41 +00:00
|
|
|
OBJ_DESTRUCT(&ep->frag_wait_list);
|
2012-04-19 21:51:55 +00:00
|
|
|
OBJ_DESTRUCT(&ep->lock);
|
2017-03-12 22:37:35 -06:00
|
|
|
free (ep->remote_attr);
|
2011-12-09 21:24:07 +00:00
|
|
|
}
|
|
|
|
|
2014-07-09 19:33:58 +00:00
|
|
|
OBJ_CLASS_INSTANCE(mca_btl_ugni_endpoint_t, opal_list_item_t,
|
2012-05-31 20:02:41 +00:00
|
|
|
mca_btl_ugni_ep_construct, mca_btl_ugni_ep_destruct);
|
2011-12-09 21:24:07 +00:00
|
|
|
|
2017-03-12 22:37:35 -06:00
|
|
|
static int mca_btl_ugni_endpoint_get_modex (mca_btl_base_endpoint_t *ep)
|
|
|
|
{
|
|
|
|
mca_btl_ugni_modex_t *modex;
|
|
|
|
size_t msg_size;
|
|
|
|
int rc;
|
|
|
|
|
|
|
|
assert (NULL != ep && NULL != ep->peer_proc);
|
|
|
|
|
|
|
|
/* Receive the modex */
|
|
|
|
OPAL_MODEX_RECV(rc, &mca_btl_ugni_component.super.btl_version,
|
|
|
|
&ep->peer_proc->proc_name, (void **)&modex, &msg_size);
|
|
|
|
if (OPAL_UNLIKELY(OPAL_SUCCESS != rc)) {
|
|
|
|
BTL_ERROR(("error receiving modex"));
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
ep->ep_rem_addr = modex->addr;
|
|
|
|
ep->ep_rem_id = modex->id;
|
|
|
|
|
|
|
|
|
2017-03-24 13:37:11 -06:00
|
|
|
BTL_VERBOSE(("received modex for ep %p. addr: %d, id: %d", (void*)ep, ep->ep_rem_addr, ep->ep_rem_id));
|
2017-03-12 22:37:35 -06:00
|
|
|
|
|
|
|
free (modex);
|
|
|
|
|
|
|
|
return OPAL_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
int mca_btl_ugni_init_ep (mca_btl_ugni_module_t *ugni_module, mca_btl_ugni_endpoint_t **ep,
|
|
|
|
mca_btl_ugni_module_t *btl, opal_proc_t *peer_proc)
|
|
|
|
{
|
|
|
|
mca_btl_ugni_endpoint_t *endpoint;
|
|
|
|
int rc;
|
|
|
|
|
|
|
|
endpoint = OBJ_NEW(mca_btl_ugni_endpoint_t);
|
|
|
|
assert (endpoint != NULL);
|
|
|
|
|
|
|
|
endpoint->smsg_progressing = 0;
|
|
|
|
endpoint->state = MCA_BTL_UGNI_EP_STATE_INIT;
|
|
|
|
endpoint->peer_proc = peer_proc;
|
|
|
|
|
|
|
|
/* get the modex info for this endpoint and setup a ugni endpoint. this call may lead
|
|
|
|
* to re-entry through opal_progress(). */
|
|
|
|
rc = mca_btl_ugni_endpoint_get_modex (endpoint);
|
|
|
|
if (OPAL_SUCCESS != rc) {
|
|
|
|
assert (0);
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* add this endpoint to the pointer array */
|
|
|
|
endpoint->index = opal_pointer_array_add (&ugni_module->endpoints, endpoint);
|
|
|
|
|
|
|
|
*ep = endpoint;
|
|
|
|
|
|
|
|
return OPAL_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
void mca_btl_ugni_release_ep (mca_btl_ugni_endpoint_t *ep)
|
|
|
|
{
|
|
|
|
mca_btl_ugni_module_t *ugni_module = mca_btl_ugni_ep_btl (ep);
|
|
|
|
int rc;
|
|
|
|
|
|
|
|
opal_mutex_lock (&ep->lock);
|
|
|
|
|
|
|
|
rc = mca_btl_ugni_ep_disconnect (ep, false);
|
|
|
|
if (OPAL_UNLIKELY(OPAL_SUCCESS != rc)) {
|
|
|
|
BTL_VERBOSE(("btl/ugni error disconnecting endpoint"));
|
|
|
|
}
|
|
|
|
|
|
|
|
/* TODO -- Clear space at the end of the endpoint array */
|
|
|
|
opal_pointer_array_set_item (&ugni_module->endpoints, ep->index, NULL);
|
|
|
|
|
|
|
|
opal_mutex_unlock (&ep->lock);
|
|
|
|
|
|
|
|
OBJ_RELEASE(ep);
|
|
|
|
}
|
|
|
|
|
2011-12-09 21:24:07 +00:00
|
|
|
static inline int mca_btl_ugni_ep_smsg_get_mbox (mca_btl_base_endpoint_t *ep) {
|
2017-03-12 22:37:35 -06:00
|
|
|
mca_btl_ugni_module_t *ugni_module = mca_btl_ugni_ep_btl (ep);
|
2015-02-19 13:41:41 -07:00
|
|
|
opal_free_list_item_t *mbox;
|
2011-12-09 21:24:07 +00:00
|
|
|
|
2017-03-12 22:37:35 -06:00
|
|
|
assert (NULL == ep->mailbox);
|
|
|
|
|
2015-02-19 13:41:41 -07:00
|
|
|
mbox = opal_free_list_get (&ugni_module->smsg_mboxes);
|
2011-12-09 21:24:07 +00:00
|
|
|
if (OPAL_UNLIKELY(NULL == mbox)) {
|
George did the work and deserves all the credit for it. Ralph did the merge, and deserves whatever blame results from errors in it :-)
WHAT: Open our low-level communication infrastructure by moving all necessary components (btl/rcache/allocator/mpool) down in OPAL
All the components required for inter-process communications are currently deeply integrated in the OMPI layer. Several groups/institutions have express interest in having a more generic communication infrastructure, without all the OMPI layer dependencies. This communication layer should be made available at a different software level, available to all layers in the Open MPI software stack. As an example, our ORTE layer could replace the current OOB and instead use the BTL directly, gaining access to more reactive network interfaces than TCP. Similarly, external software libraries could take advantage of our highly optimized AM (active message) communication layer for their own purpose. UTK with support from Sandia, developped a version of Open MPI where the entire communication infrastucture has been moved down to OPAL (btl/rcache/allocator/mpool). Most of the moved components have been updated to match the new schema, with few exceptions (mainly BTLs where I have no way of compiling/testing them). Thus, the completion of this RFC is tied to being able to completing this move for all BTLs. For this we need help from the rest of the Open MPI community, especially those supporting some of the BTLs. A non-exhaustive list of BTLs that qualify here is: mx, portals4, scif, udapl, ugni, usnic.
This commit was SVN r32317.
2014-07-26 00:47:28 +00:00
|
|
|
return OPAL_ERR_OUT_OF_RESOURCE;
|
2011-12-09 21:24:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ep->mailbox = (mca_btl_ugni_smsg_mbox_t *) mbox;
|
2013-11-18 04:58:37 +00:00
|
|
|
ep->mailbox->attr.index = ep->index;
|
2011-12-09 21:24:07 +00:00
|
|
|
|
|
|
|
/* per ugni spec we need to zero mailbox data before connecting */
|
2013-11-18 04:58:37 +00:00
|
|
|
memset ((char *)ep->mailbox->attr.smsg_attr.msg_buffer + ep->mailbox->attr.smsg_attr.mbox_offset, 0,
|
|
|
|
ep->mailbox->attr.smsg_attr.buff_size);
|
George did the work and deserves all the credit for it. Ralph did the merge, and deserves whatever blame results from errors in it :-)
WHAT: Open our low-level communication infrastructure by moving all necessary components (btl/rcache/allocator/mpool) down in OPAL
All the components required for inter-process communications are currently deeply integrated in the OMPI layer. Several groups/institutions have express interest in having a more generic communication infrastructure, without all the OMPI layer dependencies. This communication layer should be made available at a different software level, available to all layers in the Open MPI software stack. As an example, our ORTE layer could replace the current OOB and instead use the BTL directly, gaining access to more reactive network interfaces than TCP. Similarly, external software libraries could take advantage of our highly optimized AM (active message) communication layer for their own purpose. UTK with support from Sandia, developped a version of Open MPI where the entire communication infrastucture has been moved down to OPAL (btl/rcache/allocator/mpool). Most of the moved components have been updated to match the new schema, with few exceptions (mainly BTLs where I have no way of compiling/testing them). Thus, the completion of this RFC is tied to being able to completing this move for all BTLs. For this we need help from the rest of the Open MPI community, especially those supporting some of the BTLs. A non-exhaustive list of BTLs that qualify here is: mx, portals4, scif, udapl, ugni, usnic.
This commit was SVN r32317.
2014-07-26 00:47:28 +00:00
|
|
|
return OPAL_SUCCESS;
|
2011-12-09 21:24:07 +00:00
|
|
|
}
|
|
|
|
|
2017-03-12 22:37:35 -06:00
|
|
|
static int mca_btl_ugni_ep_send_disconnect (mca_btl_base_endpoint_t *ep)
|
|
|
|
{
|
|
|
|
int rc;
|
|
|
|
|
|
|
|
do {
|
|
|
|
rc = mca_btl_ugni_endpoint_smsg_send_wtag (ep, NULL, 0, NULL, 0, -1, MCA_BTL_UGNI_TAG_DISCONNECT);
|
|
|
|
if (OPAL_LIKELY(GNI_RC_NOT_DONE != rc)) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* most likely got here because we are out of credits. check the remote CQ to get credit return */
|
|
|
|
(void) mca_btl_ugni_progress_remote_smsg (mca_btl_ugni_ep_btl (ep));
|
|
|
|
} while (1);
|
|
|
|
|
|
|
|
return mca_btl_rc_ugni_to_opal (rc);
|
|
|
|
}
|
|
|
|
|
|
|
|
int mca_btl_ugni_ep_disconnect (mca_btl_base_endpoint_t *ep, bool send_disconnect)
|
|
|
|
{
|
|
|
|
mca_btl_ugni_module_t *ugni_module = mca_btl_ugni_ep_btl (ep);
|
|
|
|
mca_btl_ugni_device_t *device;
|
|
|
|
int rc;
|
2011-12-09 21:24:07 +00:00
|
|
|
|
2013-11-18 04:58:37 +00:00
|
|
|
if (MCA_BTL_UGNI_EP_STATE_INIT == ep->state) {
|
|
|
|
/* nothing to do */
|
George did the work and deserves all the credit for it. Ralph did the merge, and deserves whatever blame results from errors in it :-)
WHAT: Open our low-level communication infrastructure by moving all necessary components (btl/rcache/allocator/mpool) down in OPAL
All the components required for inter-process communications are currently deeply integrated in the OMPI layer. Several groups/institutions have express interest in having a more generic communication infrastructure, without all the OMPI layer dependencies. This communication layer should be made available at a different software level, available to all layers in the Open MPI software stack. As an example, our ORTE layer could replace the current OOB and instead use the BTL directly, gaining access to more reactive network interfaces than TCP. Similarly, external software libraries could take advantage of our highly optimized AM (active message) communication layer for their own purpose. UTK with support from Sandia, developped a version of Open MPI where the entire communication infrastucture has been moved down to OPAL (btl/rcache/allocator/mpool). Most of the moved components have been updated to match the new schema, with few exceptions (mainly BTLs where I have no way of compiling/testing them). Thus, the completion of this RFC is tied to being able to completing this move for all BTLs. For this we need help from the rest of the Open MPI community, especially those supporting some of the BTLs. A non-exhaustive list of BTLs that qualify here is: mx, portals4, scif, udapl, ugni, usnic.
This commit was SVN r32317.
2014-07-26 00:47:28 +00:00
|
|
|
return OPAL_SUCCESS;
|
2013-11-18 04:58:37 +00:00
|
|
|
}
|
2011-12-09 21:24:07 +00:00
|
|
|
|
2017-03-12 22:37:35 -06:00
|
|
|
device = ep->smsg_ep_handle->device;
|
|
|
|
|
|
|
|
while (device->dev_smsg_local_cq.active_operations) {
|
|
|
|
/* ensure all sends are complete before removing and procs */
|
|
|
|
rc = mca_btl_ugni_progress_local_smsg (ugni_module, device);
|
|
|
|
if (OPAL_SUCCESS != rc) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-11-18 04:58:37 +00:00
|
|
|
if (MCA_BTL_UGNI_EP_STATE_CONNECTED == ep->state && send_disconnect) {
|
2017-03-12 22:37:35 -06:00
|
|
|
rc = mca_btl_ugni_ep_send_disconnect (ep);
|
|
|
|
if (OPAL_UNLIKELY(OPAL_SUCCESS != rc)) {
|
|
|
|
BTL_VERBOSE(("could not send disconnect message to peer"));
|
2011-12-09 21:24:07 +00:00
|
|
|
}
|
|
|
|
|
2017-03-12 22:37:35 -06:00
|
|
|
/* wait for the disconnect messagse to go */
|
|
|
|
do {
|
|
|
|
/* ensure all sends are complete before removing and procs */
|
|
|
|
rc = mca_btl_ugni_progress_local_smsg (ugni_module, device);
|
|
|
|
if (OPAL_SUCCESS != rc) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
} while (device->dev_smsg_local_cq.active_operations);
|
2014-10-08 10:10:19 -06:00
|
|
|
|
2017-03-12 22:37:35 -06:00
|
|
|
(void) opal_atomic_add_32 (&ep->smsg_ep_handle->device->smsg_connections, -1);
|
2013-11-18 04:58:37 +00:00
|
|
|
}
|
|
|
|
|
2017-03-12 22:37:35 -06:00
|
|
|
mca_btl_ugni_device_lock (device);
|
|
|
|
|
|
|
|
/* NTH: this call may not need the device lock. seems to work without it but
|
|
|
|
* the lock is here to be safe. */
|
|
|
|
(void) mca_btl_ugni_ep_handle_destroy (ep->smsg_ep_handle);
|
|
|
|
ep->smsg_ep_handle = NULL;
|
|
|
|
|
|
|
|
mca_btl_ugni_device_unlock (device);
|
2011-12-09 21:24:07 +00:00
|
|
|
|
2015-01-07 13:48:17 -07:00
|
|
|
if (ep->mailbox) {
|
2017-03-12 22:37:35 -06:00
|
|
|
opal_free_list_return (&ugni_module->smsg_mboxes, ((opal_free_list_item_t *) ep->mailbox));
|
2015-01-07 13:48:17 -07:00
|
|
|
ep->mailbox = NULL;
|
|
|
|
}
|
2012-05-31 20:02:41 +00:00
|
|
|
|
2013-11-18 04:58:37 +00:00
|
|
|
ep->state = MCA_BTL_UGNI_EP_STATE_INIT;
|
2011-12-09 21:24:07 +00:00
|
|
|
|
George did the work and deserves all the credit for it. Ralph did the merge, and deserves whatever blame results from errors in it :-)
WHAT: Open our low-level communication infrastructure by moving all necessary components (btl/rcache/allocator/mpool) down in OPAL
All the components required for inter-process communications are currently deeply integrated in the OMPI layer. Several groups/institutions have express interest in having a more generic communication infrastructure, without all the OMPI layer dependencies. This communication layer should be made available at a different software level, available to all layers in the Open MPI software stack. As an example, our ORTE layer could replace the current OOB and instead use the BTL directly, gaining access to more reactive network interfaces than TCP. Similarly, external software libraries could take advantage of our highly optimized AM (active message) communication layer for their own purpose. UTK with support from Sandia, developped a version of Open MPI where the entire communication infrastucture has been moved down to OPAL (btl/rcache/allocator/mpool). Most of the moved components have been updated to match the new schema, with few exceptions (mainly BTLs where I have no way of compiling/testing them). Thus, the completion of this RFC is tied to being able to completing this move for all BTLs. For this we need help from the rest of the Open MPI community, especially those supporting some of the BTLs. A non-exhaustive list of BTLs that qualify here is: mx, portals4, scif, udapl, ugni, usnic.
This commit was SVN r32317.
2014-07-26 00:47:28 +00:00
|
|
|
return OPAL_SUCCESS;
|
2011-12-09 21:24:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline int mca_btl_ugni_ep_connect_start (mca_btl_base_endpoint_t *ep) {
|
2017-03-12 22:37:35 -06:00
|
|
|
mca_btl_ugni_module_t *ugni_module = mca_btl_ugni_ep_btl (ep);
|
|
|
|
mca_btl_ugni_device_t *device = ugni_module->devices;
|
2011-12-09 21:24:07 +00:00
|
|
|
int rc;
|
|
|
|
|
2017-03-12 22:37:35 -06:00
|
|
|
/* protect against re-entry from opal_progress */
|
|
|
|
if (OPAL_UNLIKELY(MCA_BTL_UGNI_EP_STATE_CONNECTING == ep->state)) {
|
|
|
|
return OPAL_ERR_RESOURCE_BUSY;
|
2011-12-09 21:24:07 +00:00
|
|
|
}
|
|
|
|
|
2017-03-12 22:37:35 -06:00
|
|
|
ep->state = MCA_BTL_UGNI_EP_STATE_CONNECTING;
|
|
|
|
|
|
|
|
BTL_VERBOSE(("initiating connection to remote peer with address: %u id: %u proc: %p",
|
|
|
|
ep->ep_rem_addr, ep->ep_rem_id, (void *)ep->peer_proc));
|
2014-11-13 08:26:25 -07:00
|
|
|
|
2014-11-05 08:32:23 -07:00
|
|
|
/* bind endpoint to remote address */
|
|
|
|
/* we bind two endpoints to seperate out local smsg completion and local fma completion */
|
2017-03-12 22:37:35 -06:00
|
|
|
mca_btl_ugni_device_lock (device);
|
|
|
|
ep->smsg_ep_handle = mca_btl_ugni_ep_handle_create (ep, device->dev_smsg_local_cq.gni_handle, device);
|
|
|
|
mca_btl_ugni_device_unlock (device);
|
|
|
|
if (OPAL_UNLIKELY(NULL == ep->smsg_ep_handle)) {
|
|
|
|
return OPAL_ERR_OUT_OF_RESOURCE;
|
2012-04-19 21:51:55 +00:00
|
|
|
}
|
2011-12-09 21:24:07 +00:00
|
|
|
|
|
|
|
/* build connection data */
|
|
|
|
rc = mca_btl_ugni_ep_smsg_get_mbox (ep);
|
George did the work and deserves all the credit for it. Ralph did the merge, and deserves whatever blame results from errors in it :-)
WHAT: Open our low-level communication infrastructure by moving all necessary components (btl/rcache/allocator/mpool) down in OPAL
All the components required for inter-process communications are currently deeply integrated in the OMPI layer. Several groups/institutions have express interest in having a more generic communication infrastructure, without all the OMPI layer dependencies. This communication layer should be made available at a different software level, available to all layers in the Open MPI software stack. As an example, our ORTE layer could replace the current OOB and instead use the BTL directly, gaining access to more reactive network interfaces than TCP. Similarly, external software libraries could take advantage of our highly optimized AM (active message) communication layer for their own purpose. UTK with support from Sandia, developped a version of Open MPI where the entire communication infrastucture has been moved down to OPAL (btl/rcache/allocator/mpool). Most of the moved components have been updated to match the new schema, with few exceptions (mainly BTLs where I have no way of compiling/testing them). Thus, the completion of this RFC is tied to being able to completing this move for all BTLs. For this we need help from the rest of the Open MPI community, especially those supporting some of the BTLs. A non-exhaustive list of BTLs that qualify here is: mx, portals4, scif, udapl, ugni, usnic.
This commit was SVN r32317.
2014-07-26 00:47:28 +00:00
|
|
|
if (OPAL_UNLIKELY(OPAL_SUCCESS != rc)) {
|
2011-12-09 21:24:07 +00:00
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
2017-03-12 22:37:35 -06:00
|
|
|
ep->remote_attr = calloc (1, sizeof (*ep->remote_attr));
|
|
|
|
if (OPAL_UNLIKELY(NULL == ep->remote_attr)) {
|
|
|
|
return OPAL_ERR_OUT_OF_RESOURCE;
|
|
|
|
}
|
2011-12-09 21:24:07 +00:00
|
|
|
|
|
|
|
BTL_VERBOSE(("btl/ugni connection to remote peer initiated"));
|
|
|
|
|
George did the work and deserves all the credit for it. Ralph did the merge, and deserves whatever blame results from errors in it :-)
WHAT: Open our low-level communication infrastructure by moving all necessary components (btl/rcache/allocator/mpool) down in OPAL
All the components required for inter-process communications are currently deeply integrated in the OMPI layer. Several groups/institutions have express interest in having a more generic communication infrastructure, without all the OMPI layer dependencies. This communication layer should be made available at a different software level, available to all layers in the Open MPI software stack. As an example, our ORTE layer could replace the current OOB and instead use the BTL directly, gaining access to more reactive network interfaces than TCP. Similarly, external software libraries could take advantage of our highly optimized AM (active message) communication layer for their own purpose. UTK with support from Sandia, developped a version of Open MPI where the entire communication infrastucture has been moved down to OPAL (btl/rcache/allocator/mpool). Most of the moved components have been updated to match the new schema, with few exceptions (mainly BTLs where I have no way of compiling/testing them). Thus, the completion of this RFC is tied to being able to completing this move for all BTLs. For this we need help from the rest of the Open MPI community, especially those supporting some of the BTLs. A non-exhaustive list of BTLs that qualify here is: mx, portals4, scif, udapl, ugni, usnic.
This commit was SVN r32317.
2014-07-26 00:47:28 +00:00
|
|
|
return OPAL_SUCCESS;
|
2011-12-09 21:24:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline int mca_btl_ugni_ep_connect_finish (mca_btl_base_endpoint_t *ep) {
|
2017-03-12 22:37:35 -06:00
|
|
|
mca_btl_ugni_module_t *ugni_module = mca_btl_ugni_ep_btl (ep);
|
2012-05-31 20:02:41 +00:00
|
|
|
gni_return_t grc;
|
2011-12-09 21:24:07 +00:00
|
|
|
int rc;
|
|
|
|
|
|
|
|
BTL_VERBOSE(("finishing connection. remote attributes: msg_type = %d, msg_buffer = %p, buff_size = %d, "
|
|
|
|
"mem_hndl = {qword1 = %" PRIu64 ", qword2 = %" PRIu64 "}, mbox = %d, mbox_maxcredit = %d, "
|
2017-03-12 22:37:35 -06:00
|
|
|
"msg_maxsize = %d", ep->remote_attr->smsg_attr.msg_type, ep->remote_attr->smsg_attr.msg_buffer,
|
|
|
|
ep->remote_attr->smsg_attr.buff_size, ep->remote_attr->smsg_attr.mem_hndl.qword1,
|
|
|
|
ep->remote_attr->smsg_attr.mem_hndl.qword2, ep->remote_attr->smsg_attr.mbox_offset,
|
|
|
|
ep->remote_attr->smsg_attr.mbox_maxcredit, ep->remote_attr->smsg_attr.msg_maxsize));
|
2011-12-09 21:24:07 +00:00
|
|
|
|
|
|
|
BTL_VERBOSE(("finishing connection. local attributes: msg_type = %d, msg_buffer = %p, buff_size = %d, "
|
|
|
|
"mem_hndl = {qword1 = %" PRIu64 ", qword2 = %" PRIu64 "}, mbox = %d, mbox_maxcredit = %d, "
|
2013-11-18 04:58:37 +00:00
|
|
|
"msg_maxsize = %d", ep->mailbox->attr.smsg_attr.msg_type, ep->mailbox->attr.smsg_attr.msg_buffer,
|
|
|
|
ep->mailbox->attr.smsg_attr.buff_size, ep->mailbox->attr.smsg_attr.mem_hndl.qword1,
|
|
|
|
ep->mailbox->attr.smsg_attr.mem_hndl.qword2, ep->mailbox->attr.smsg_attr.mbox_offset,
|
|
|
|
ep->mailbox->attr.smsg_attr.mbox_maxcredit, ep->mailbox->attr.smsg_attr.msg_maxsize));
|
2011-12-09 21:24:07 +00:00
|
|
|
|
2017-03-12 22:37:35 -06:00
|
|
|
grc = GNI_SmsgInit (ep->smsg_ep_handle->gni_handle, &ep->mailbox->attr.smsg_attr,
|
|
|
|
&ep->remote_attr->smsg_attr);
|
2012-05-31 20:02:41 +00:00
|
|
|
if (OPAL_UNLIKELY(GNI_RC_SUCCESS != grc)) {
|
|
|
|
BTL_ERROR(("error initializing SMSG protocol. rc = %d", grc));
|
2012-04-19 21:51:55 +00:00
|
|
|
|
2017-03-12 22:37:35 -06:00
|
|
|
return mca_btl_rc_ugni_to_opal (grc);
|
2011-12-09 21:24:07 +00:00
|
|
|
}
|
|
|
|
|
2013-11-18 04:58:37 +00:00
|
|
|
/* set the local event data to the local index and the remote event data to my
|
|
|
|
* index on the remote peer. This makes lookup of endpoints on completion take
|
|
|
|
* a single lookup in the endpoints array. we will not be able to change the
|
|
|
|
* remote peer's index in the endpoint's array after this point. */
|
2017-03-12 22:37:35 -06:00
|
|
|
GNI_EpSetEventData (ep->smsg_ep_handle->gni_handle, ep->index, ep->remote_attr->index);
|
2013-11-18 04:58:37 +00:00
|
|
|
|
2017-03-12 22:37:35 -06:00
|
|
|
ep->rmt_irq_mem_hndl = ep->remote_attr->rmt_irq_mem_hndl;
|
2012-04-19 21:51:55 +00:00
|
|
|
ep->state = MCA_BTL_UGNI_EP_STATE_CONNECTED;
|
2017-03-12 22:37:35 -06:00
|
|
|
(void) opal_atomic_add_32 (&ep->smsg_ep_handle->device->smsg_connections, 1);
|
2011-12-09 21:24:07 +00:00
|
|
|
|
2012-05-31 20:02:41 +00:00
|
|
|
/* send all pending messages */
|
|
|
|
BTL_VERBOSE(("endpoint connected. posting %u sends", (unsigned int) opal_list_get_size (&ep->frag_wait_list)));
|
|
|
|
|
2014-07-09 19:33:58 +00:00
|
|
|
rc = mca_btl_ugni_progress_send_wait_list (ep);
|
George did the work and deserves all the credit for it. Ralph did the merge, and deserves whatever blame results from errors in it :-)
WHAT: Open our low-level communication infrastructure by moving all necessary components (btl/rcache/allocator/mpool) down in OPAL
All the components required for inter-process communications are currently deeply integrated in the OMPI layer. Several groups/institutions have express interest in having a more generic communication infrastructure, without all the OMPI layer dependencies. This communication layer should be made available at a different software level, available to all layers in the Open MPI software stack. As an example, our ORTE layer could replace the current OOB and instead use the BTL directly, gaining access to more reactive network interfaces than TCP. Similarly, external software libraries could take advantage of our highly optimized AM (active message) communication layer for their own purpose. UTK with support from Sandia, developped a version of Open MPI where the entire communication infrastucture has been moved down to OPAL (btl/rcache/allocator/mpool). Most of the moved components have been updated to match the new schema, with few exceptions (mainly BTLs where I have no way of compiling/testing them). Thus, the completion of this RFC is tied to being able to completing this move for all BTLs. For this we need help from the rest of the Open MPI community, especially those supporting some of the BTLs. A non-exhaustive list of BTLs that qualify here is: mx, portals4, scif, udapl, ugni, usnic.
This commit was SVN r32317.
2014-07-26 00:47:28 +00:00
|
|
|
if (OPAL_UNLIKELY(OPAL_SUCCESS != rc)) {
|
2017-03-12 22:37:35 -06:00
|
|
|
OPAL_THREAD_LOCK(&ugni_module->ep_wait_list_lock);
|
2016-02-02 11:57:35 -07:00
|
|
|
if (false == ep->wait_listed) {
|
2017-03-12 22:37:35 -06:00
|
|
|
opal_list_append (&ugni_module->ep_wait_list, &ep->super);
|
2016-02-02 11:57:35 -07:00
|
|
|
ep->wait_listed = true;
|
|
|
|
}
|
2017-03-12 22:37:35 -06:00
|
|
|
OPAL_THREAD_UNLOCK(&ugni_module->ep_wait_list_lock);
|
2011-12-09 21:24:07 +00:00
|
|
|
}
|
|
|
|
|
2017-03-12 22:37:35 -06:00
|
|
|
free (ep->remote_attr);
|
|
|
|
ep->remote_attr = NULL;
|
|
|
|
|
George did the work and deserves all the credit for it. Ralph did the merge, and deserves whatever blame results from errors in it :-)
WHAT: Open our low-level communication infrastructure by moving all necessary components (btl/rcache/allocator/mpool) down in OPAL
All the components required for inter-process communications are currently deeply integrated in the OMPI layer. Several groups/institutions have express interest in having a more generic communication infrastructure, without all the OMPI layer dependencies. This communication layer should be made available at a different software level, available to all layers in the Open MPI software stack. As an example, our ORTE layer could replace the current OOB and instead use the BTL directly, gaining access to more reactive network interfaces than TCP. Similarly, external software libraries could take advantage of our highly optimized AM (active message) communication layer for their own purpose. UTK with support from Sandia, developped a version of Open MPI where the entire communication infrastucture has been moved down to OPAL (btl/rcache/allocator/mpool). Most of the moved components have been updated to match the new schema, with few exceptions (mainly BTLs where I have no way of compiling/testing them). Thus, the completion of this RFC is tied to being able to completing this move for all BTLs. For this we need help from the rest of the Open MPI community, especially those supporting some of the BTLs. A non-exhaustive list of BTLs that qualify here is: mx, portals4, scif, udapl, ugni, usnic.
This commit was SVN r32317.
2014-07-26 00:47:28 +00:00
|
|
|
return OPAL_SUCCESS;
|
2011-12-09 21:24:07 +00:00
|
|
|
}
|
|
|
|
|
2017-03-12 22:37:35 -06:00
|
|
|
static int mca_btl_ugni_directed_ep_post (mca_btl_base_endpoint_t *ep)
|
|
|
|
{
|
|
|
|
mca_btl_ugni_module_t *ugni_module = mca_btl_ugni_ep_btl (ep);
|
2012-05-31 20:02:41 +00:00
|
|
|
gni_return_t rc;
|
|
|
|
|
2017-03-12 22:37:35 -06:00
|
|
|
BTL_VERBOSE(("posting directed datagram to remote id: %d for endpoint %p", ep->ep_rem_id, (void *)ep));
|
|
|
|
/* the irq cq is associated with only the first device */
|
|
|
|
ep->mailbox->attr.rmt_irq_mem_hndl = ugni_module->devices->smsg_irq_mhndl;
|
2013-11-18 04:58:37 +00:00
|
|
|
|
2017-03-12 22:37:35 -06:00
|
|
|
rc = GNI_EpPostDataWId (ep->smsg_ep_handle->gni_handle, &ep->mailbox->attr, sizeof (ep->mailbox->attr),
|
|
|
|
ep->remote_attr, sizeof (*ep->remote_attr),
|
2013-11-18 04:58:37 +00:00
|
|
|
MCA_BTL_UGNI_CONNECT_DIRECTED_ID | ep->index);
|
2017-03-14 10:10:05 -06:00
|
|
|
if (OPAL_LIKELY(GNI_RC_SUCCESS == rc)) {
|
|
|
|
(void) opal_atomic_add_32 (&ugni_module->active_datagrams, 1);
|
|
|
|
}
|
2012-05-31 20:02:41 +00:00
|
|
|
|
2017-03-12 22:37:35 -06:00
|
|
|
return mca_btl_rc_ugni_to_opal (rc);
|
|
|
|
}
|
|
|
|
|
|
|
|
int mca_btl_ugni_wildcard_ep_post (mca_btl_ugni_module_t *ugni_module)
|
|
|
|
{
|
|
|
|
gni_return_t rc;
|
|
|
|
|
|
|
|
BTL_VERBOSE(("posting wildcard datagram"));
|
|
|
|
|
|
|
|
memset (&ugni_module->wc_local_attr, 0, sizeof (ugni_module->wc_local_attr));
|
|
|
|
memset (&ugni_module->wc_remote_attr, 0, sizeof (ugni_module->wc_remote_attr));
|
|
|
|
rc = GNI_EpPostDataWId (ugni_module->wildcard_ep, &ugni_module->wc_local_attr,
|
|
|
|
sizeof (ugni_module->wc_local_attr), &ugni_module->wc_remote_attr,
|
|
|
|
sizeof (ugni_module->wc_remote_attr), MCA_BTL_UGNI_CONNECT_WILDCARD_ID);
|
|
|
|
|
|
|
|
return mca_btl_rc_ugni_to_opal (rc);
|
2012-05-31 20:02:41 +00:00
|
|
|
}
|
|
|
|
|
2017-03-12 22:37:35 -06:00
|
|
|
|
|
|
|
int mca_btl_ugni_ep_connect_progress (mca_btl_base_endpoint_t *ep)
|
|
|
|
{
|
2011-12-09 21:24:07 +00:00
|
|
|
int rc;
|
|
|
|
|
2014-10-08 10:10:19 -06:00
|
|
|
BTL_VERBOSE(("progressing connection for endpoint %p with state %d", (void *)ep, ep->state));
|
2013-11-18 04:58:37 +00:00
|
|
|
|
2012-04-19 21:51:55 +00:00
|
|
|
if (MCA_BTL_UGNI_EP_STATE_CONNECTED == ep->state) {
|
George did the work and deserves all the credit for it. Ralph did the merge, and deserves whatever blame results from errors in it :-)
WHAT: Open our low-level communication infrastructure by moving all necessary components (btl/rcache/allocator/mpool) down in OPAL
All the components required for inter-process communications are currently deeply integrated in the OMPI layer. Several groups/institutions have express interest in having a more generic communication infrastructure, without all the OMPI layer dependencies. This communication layer should be made available at a different software level, available to all layers in the Open MPI software stack. As an example, our ORTE layer could replace the current OOB and instead use the BTL directly, gaining access to more reactive network interfaces than TCP. Similarly, external software libraries could take advantage of our highly optimized AM (active message) communication layer for their own purpose. UTK with support from Sandia, developped a version of Open MPI where the entire communication infrastucture has been moved down to OPAL (btl/rcache/allocator/mpool). Most of the moved components have been updated to match the new schema, with few exceptions (mainly BTLs where I have no way of compiling/testing them). Thus, the completion of this RFC is tied to being able to completing this move for all BTLs. For this we need help from the rest of the Open MPI community, especially those supporting some of the BTLs. A non-exhaustive list of BTLs that qualify here is: mx, portals4, scif, udapl, ugni, usnic.
This commit was SVN r32317.
2014-07-26 00:47:28 +00:00
|
|
|
return OPAL_SUCCESS;
|
2011-12-09 21:24:07 +00:00
|
|
|
}
|
|
|
|
|
2017-03-12 22:37:35 -06:00
|
|
|
if (MCA_BTL_UGNI_EP_STATE_INIT == ep->state) {
|
2011-12-09 21:24:07 +00:00
|
|
|
rc = mca_btl_ugni_ep_connect_start (ep);
|
George did the work and deserves all the credit for it. Ralph did the merge, and deserves whatever blame results from errors in it :-)
WHAT: Open our low-level communication infrastructure by moving all necessary components (btl/rcache/allocator/mpool) down in OPAL
All the components required for inter-process communications are currently deeply integrated in the OMPI layer. Several groups/institutions have express interest in having a more generic communication infrastructure, without all the OMPI layer dependencies. This communication layer should be made available at a different software level, available to all layers in the Open MPI software stack. As an example, our ORTE layer could replace the current OOB and instead use the BTL directly, gaining access to more reactive network interfaces than TCP. Similarly, external software libraries could take advantage of our highly optimized AM (active message) communication layer for their own purpose. UTK with support from Sandia, developped a version of Open MPI where the entire communication infrastucture has been moved down to OPAL (btl/rcache/allocator/mpool). Most of the moved components have been updated to match the new schema, with few exceptions (mainly BTLs where I have no way of compiling/testing them). Thus, the completion of this RFC is tied to being able to completing this move for all BTLs. For this we need help from the rest of the Open MPI community, especially those supporting some of the BTLs. A non-exhaustive list of BTLs that qualify here is: mx, portals4, scif, udapl, ugni, usnic.
This commit was SVN r32317.
2014-07-26 00:47:28 +00:00
|
|
|
if (OPAL_SUCCESS != rc) {
|
2011-12-09 21:24:07 +00:00
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-03-24 13:37:11 -06:00
|
|
|
BTL_VERBOSE(("ep->remote_attr->smsg_attr = {.msg_type = %d, .msg_buffer = %p}", ep->remote_attr->smsg_attr.msg_type,
|
|
|
|
(void*)ep->remote_attr->smsg_attr.msg_buffer));
|
2017-03-12 22:37:35 -06:00
|
|
|
|
|
|
|
if (GNI_SMSG_TYPE_INVALID == ep->remote_attr->smsg_attr.msg_type) {
|
2012-05-31 20:02:41 +00:00
|
|
|
/* use datagram to exchange connection information with the remote peer */
|
2016-08-04 16:08:01 -06:00
|
|
|
if (!ep->dg_posted) {
|
|
|
|
rc = mca_btl_ugni_directed_ep_post (ep);
|
|
|
|
if (OPAL_SUCCESS == rc) {
|
|
|
|
ep->dg_posted = true;
|
|
|
|
rc = OPAL_ERR_RESOURCE_BUSY;
|
|
|
|
}
|
2016-09-02 09:17:44 -06:00
|
|
|
|
2016-08-04 16:08:01 -06:00
|
|
|
return rc;
|
2012-04-19 21:51:55 +00:00
|
|
|
}
|
2016-09-02 09:17:44 -06:00
|
|
|
|
|
|
|
return OPAL_SUCCESS;
|
2011-12-09 21:24:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return mca_btl_ugni_ep_connect_finish (ep);
|
|
|
|
}
|
2017-03-12 22:37:35 -06:00
|
|
|
|
|
|
|
int mca_btl_ugni_endpoint_handle_init_rdma (opal_free_list_item_t *item, void *ctx)
|
|
|
|
{
|
|
|
|
mca_btl_ugni_endpoint_handle_t *handle = (mca_btl_ugni_endpoint_handle_t *) item;
|
|
|
|
mca_btl_ugni_device_t *device = (mca_btl_ugni_device_t *) ctx;
|
|
|
|
gni_return_t grc;
|
|
|
|
|
|
|
|
grc = GNI_EpCreate (device->dev_handle, device->dev_rdma_local_cq.gni_handle, &handle->gni_handle);
|
|
|
|
handle->device = device;
|
|
|
|
return mca_btl_rc_ugni_to_opal (grc);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void mca_btl_ugni_endpoint_handle_construct (mca_btl_ugni_endpoint_handle_t *handle)
|
|
|
|
{
|
|
|
|
handle->gni_handle = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void mca_btl_ugni_endpoint_handle_destruct (mca_btl_ugni_endpoint_handle_t *handle)
|
|
|
|
{
|
|
|
|
if (handle->gni_handle) {
|
|
|
|
GNI_EpDestroy (handle->gni_handle);
|
|
|
|
handle->gni_handle = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
OBJ_CLASS_INSTANCE(mca_btl_ugni_endpoint_handle_t, opal_object_t,
|
|
|
|
mca_btl_ugni_endpoint_handle_construct,
|
|
|
|
mca_btl_ugni_endpoint_handle_destruct);
|
|
|
|
|
|
|
|
mca_btl_ugni_endpoint_handle_t *mca_btl_ugni_ep_handle_create (mca_btl_ugni_endpoint_t *ep, gni_cq_handle_t cq,
|
|
|
|
mca_btl_ugni_device_t *device)
|
|
|
|
{
|
|
|
|
mca_btl_ugni_endpoint_handle_t *ep_handle;
|
|
|
|
gni_return_t grc;
|
|
|
|
|
|
|
|
ep_handle = OBJ_NEW(mca_btl_ugni_endpoint_handle_t);
|
|
|
|
if (OPAL_UNLIKELY(NULL == ep_handle)) {
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
ep_handle->device = device;
|
|
|
|
|
|
|
|
/* create a uGNI endpoint handle and bind it to the remote peer */
|
|
|
|
grc = GNI_EpCreate (device->dev_handle, cq, &ep_handle->gni_handle);
|
|
|
|
if (OPAL_LIKELY(GNI_RC_SUCCESS == grc)) {
|
|
|
|
grc = GNI_EpBind (ep_handle->gni_handle, ep->ep_rem_addr, ep->ep_rem_id);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (GNI_RC_SUCCESS != grc) {
|
|
|
|
OBJ_RELEASE(ep_handle);
|
|
|
|
ep_handle = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ep_handle;
|
|
|
|
}
|
|
|
|
|
|
|
|
int mca_btl_ugni_ep_handle_destroy (mca_btl_ugni_endpoint_handle_t *ep_handle)
|
|
|
|
{
|
|
|
|
int rc;
|
|
|
|
|
|
|
|
if (NULL == ep_handle || 0 == ep_handle->gni_handle) {
|
|
|
|
return OPAL_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* TODO: need to fix, may be outstanding tx's, etc. */
|
|
|
|
rc = GNI_EpUnbind (ep_handle->gni_handle);
|
|
|
|
if (OPAL_UNLIKELY(GNI_RC_SUCCESS != rc)) {
|
|
|
|
/* should warn */
|
|
|
|
}
|
|
|
|
|
|
|
|
OBJ_RELEASE(ep_handle);
|
|
|
|
|
|
|
|
return OPAL_SUCCESS;
|
|
|
|
}
|