Ejemplo n.º 1
0
Archivo: ugni_ep.c Proyecto: hjelmn/ucx
/* Endpoint definition */
UCS_CLASS_INIT_FUNC(uct_ugni_ep_t, uct_iface_t *tl_iface,
                    const struct sockaddr *addr)
{
    uct_ugni_iface_t *iface = ucs_derived_of(tl_iface, uct_ugni_iface_t);
    const uct_sockaddr_ugni_t *iface_addr = (const uct_sockaddr_ugni_t*)addr;
    ucs_status_t rc = UCS_OK;
    gni_return_t ugni_rc;

    UCS_CLASS_CALL_SUPER_INIT(uct_base_ep_t, &iface->super);

    ugni_rc = GNI_EpCreate(iface->nic_handle, iface->local_cq, &self->ep);
    if (GNI_RC_SUCCESS != ugni_rc) {
        ucs_error("GNI_CdmCreate failed, Error status: %s %d",
                  gni_err_str[ugni_rc], ugni_rc);
        return UCS_ERR_NO_DEVICE;
    }

    if(NULL != addr){
        rc = ugni_connect_ep(iface, iface_addr, self);
    }

    ucs_arbiter_group_init(&self->arb_group);

    uint32_t *big_hash;
    big_hash = (void *)&self->ep;

    self->hash_key = big_hash[0];
    sglib_hashed_uct_ugni_ep_t_add(iface->eps, self);

    return rc;
}
Ejemplo n.º 2
0
ucs_status_t uct_ugni_smsg_ep_connect_to_ep(uct_ep_h tl_ep,
                                            const uct_device_addr_t *dev_addr,
                                            const uct_ep_addr_t *ep_addr)
{
    uct_ugni_smsg_ep_t *ep = ucs_derived_of(tl_ep, uct_ugni_smsg_ep_t);
    uct_ugni_iface_t *iface = ucs_derived_of(tl_ep->iface, uct_ugni_iface_t);
    const uct_sockaddr_smsg_ugni_t *iface_addr = (const uct_sockaddr_smsg_ugni_t*)ep_addr;
    const uct_devaddr_ugni_t *ugni_dev_addr = (const uct_devaddr_ugni_t *)dev_addr;
    gni_smsg_attr_t *local_attr = (gni_smsg_attr_t*)&ep->smsg_attr->mbox_attr;
    uct_ugni_compact_smsg_attr_t *compact_remote_attr = (uct_ugni_compact_smsg_attr_t *)&iface_addr->smsg_compact_attr;
    gni_smsg_attr_t remote_attr;
    gni_return_t gni_rc;
    ucs_status_t rc = UCS_OK;
    uint32_t ep_hash;

    uncompact_smsg_attr(ucs_derived_of(iface, uct_ugni_smsg_iface_t), compact_remote_attr, &remote_attr);
    rc = ugni_connect_ep(iface, ugni_dev_addr, &iface_addr->super, &ep->super);

    if(UCS_OK != rc){
        ucs_error("Could not connect ep in smsg");
        return rc;
    }
    uct_ugni_cdm_lock(&iface->cdm);
    gni_rc = GNI_SmsgInit(ep->super.ep, local_attr, &remote_attr);
    uct_ugni_cdm_unlock(&iface->cdm);

    if(GNI_RC_SUCCESS != gni_rc){
        ucs_error("Failed to initalize smsg. %s [%i]", gni_err_str[gni_rc], gni_rc);
        if(GNI_RC_INVALID_PARAM == gni_rc){
            return UCS_ERR_INVALID_PARAM;
        } else {
            return UCS_ERR_NO_MEMORY;
        }
    }

    ep_hash = (uint32_t)iface_addr->ep_hash;
    uct_ugni_cdm_lock(&iface->cdm);
    gni_rc = GNI_EpSetEventData(ep->super.ep, iface->cdm.domain_id, ep_hash);
    uct_ugni_cdm_unlock(&iface->cdm);

    if(GNI_RC_SUCCESS != gni_rc){
        ucs_error("Could not set GNI_EpSetEventData!");
    }
    return rc;
}
Ejemplo n.º 3
0
ucs_status_t uct_ugni_smsg_ep_connect_to_ep(uct_ep_h tl_ep, const struct sockaddr *addr){
    uct_ugni_smsg_ep_t *ep = ucs_derived_of(tl_ep, uct_ugni_smsg_ep_t);
    uct_ugni_iface_t *iface = ucs_derived_of(tl_ep->iface, uct_ugni_iface_t);
    const uct_sockaddr_smsg_ugni_t *iface_addr = (const uct_sockaddr_smsg_ugni_t*)addr;
    gni_smsg_attr_t *local_attr = (gni_smsg_attr_t*)&ep->smsg_attr->mbox_attr;
    gni_smsg_attr_t *remote_attr = (gni_smsg_attr_t *)&iface_addr->smsg_attr;
    gni_return_t gni_rc;
    ucs_status_t rc = UCS_OK;
    uint32_t ep_hash;

    pthread_mutex_lock(&uct_ugni_global_lock);
    rc = ugni_connect_ep(iface, &iface_addr->super, &ep->super);

    if(UCS_OK != rc){
        ucs_error("Could not connect ep in smsg");
        goto exit_lock;
    }

    gni_rc = GNI_SmsgInit(ep->super.ep, local_attr, remote_attr);

    if(GNI_RC_SUCCESS != gni_rc){
        ucs_error("Failed to initalize smsg. %s [%i]", gni_err_str[gni_rc], gni_rc);
        if(GNI_RC_INVALID_PARAM == gni_rc){
            rc = UCS_ERR_INVALID_PARAM;
        } else {
            rc = UCS_ERR_NO_MEMORY;
        }
        goto exit_lock;
    }

    ep_hash = (uint32_t)iface_addr->ep_hash;
    gni_rc = GNI_EpSetEventData(ep->super.ep, iface->domain_id, ep_hash);

    if(GNI_RC_SUCCESS != gni_rc){
        ucs_error("Could not set GNI_EpSetEventData!");
    }


 exit_lock:
    pthread_mutex_unlock(&uct_ugni_global_lock);

    return rc;
}