static ucs_status_t ugni_smsg_deactivate_iface(uct_ugni_smsg_iface_t *iface) { gni_return_t ugni_rc; if(!iface->super.activated) { return UCS_OK; } ugni_rc = GNI_CqDestroy(iface->super.local_cq); if (GNI_RC_SUCCESS != ugni_rc) { ucs_warn("GNI_CqDestroy failed, Error status: %s %d", gni_err_str[ugni_rc], ugni_rc); return UCS_ERR_IO_ERROR; } ugni_rc = GNI_CqDestroy(iface->remote_cq); if (GNI_RC_SUCCESS != ugni_rc) { ucs_warn("GNI_CqDestroy failed, Error status: %s %d", gni_err_str[ugni_rc], ugni_rc); return UCS_ERR_IO_ERROR; } ugni_rc = GNI_CdmDestroy(iface->super.cdm_handle); if (GNI_RC_SUCCESS != ugni_rc) { ucs_warn("GNI_CdmDestroy error status: %s (%d)", gni_err_str[ugni_rc], ugni_rc); return UCS_ERR_IO_ERROR; } iface->super.activated = false ; return UCS_OK; }
static int mca_btl_ugni_module_finalize (struct mca_btl_base_module_t *btl) { mca_btl_ugni_module_t *ugni_module = (mca_btl_ugni_module_t *)btl; mca_btl_base_endpoint_t *ep; uint64_t key; void *node; int rc; while (ugni_module->active_send_count) { /* ensure all sends are complete before closing the module */ rc = mca_btl_ugni_progress_local_smsg (ugni_module); if (OMPI_SUCCESS != rc) { break; } } OBJ_DESTRUCT(&ugni_module->eager_frags_send); OBJ_DESTRUCT(&ugni_module->eager_frags_recv); OBJ_DESTRUCT(&ugni_module->smsg_frags); OBJ_DESTRUCT(&ugni_module->rdma_frags); OBJ_DESTRUCT(&ugni_module->rdma_int_frags); OBJ_DESTRUCT(&ugni_module->ep_wait_list); /* close all open connections and release endpoints */ if (ugni_module->initialized) { rc = opal_hash_table_get_first_key_uint64 (&ugni_module->id_to_endpoint, &key, (void **) &ep, &node); while (OPAL_SUCCESS == rc) { if (NULL != ep) { mca_btl_ugni_release_ep (ep); } rc = opal_hash_table_get_next_key_uint64 (&ugni_module->id_to_endpoint, &key, (void **) &ep, node, &node); } /* destroy all cqs */ rc = GNI_CqDestroy (ugni_module->rdma_local_cq); if (GNI_RC_SUCCESS != rc) { BTL_ERROR(("error tearing down local BTE/FMA CQ")); } rc = GNI_CqDestroy (ugni_module->smsg_local_cq); if (GNI_RC_SUCCESS != rc) { BTL_ERROR(("error tearing down local SMSG CQ")); } rc = GNI_CqDestroy (ugni_module->smsg_remote_cq); if (GNI_RC_SUCCESS != rc) { BTL_ERROR(("error tearing down remote SMSG CQ")); } /* cancel wildcard post */ rc = GNI_EpPostDataCancelById (ugni_module->wildcard_ep, MCA_BTL_UGNI_CONNECT_WILDCARD_ID | OMPI_PROC_MY_NAME->vpid); if (GNI_RC_SUCCESS != rc) { BTL_VERBOSE(("btl/ugni error cancelling wildcard post")); } /* tear down wildcard endpoint */ rc = GNI_EpDestroy (ugni_module->wildcard_ep); if (GNI_RC_SUCCESS != rc) { BTL_VERBOSE(("btl/ugni error destroying endpoint")); } if (NULL != ugni_module->smsg_mpool) { (void) mca_mpool_base_module_destroy (ugni_module->smsg_mpool); ugni_module->smsg_mpool = NULL; } if (NULL != ugni_module->super.btl_mpool) { (void) mca_mpool_base_module_destroy (ugni_module->super.btl_mpool); ugni_module->super.btl_mpool = NULL; } } OBJ_DESTRUCT(&ugni_module->pending_smsg_frags_bb); OBJ_DESTRUCT(&ugni_module->id_to_endpoint); OBJ_DESTRUCT(&ugni_module->endpoints); OBJ_DESTRUCT(&ugni_module->failed_frags); ugni_module->initialized = false; return OMPI_SUCCESS; }