static void finalize(void) { proc_data_t *proc_data; uint64_t key; char *node; /* to assist in getting a clean valgrind, cycle thru the hash table * and release all data stored in it */ if (OPAL_SUCCESS == opal_hash_table_get_first_key_uint64(&hash_data, &key, (void**)&proc_data, (void**)&node)) { if (NULL != proc_data) { OBJ_RELEASE(proc_data); } while (OPAL_SUCCESS == opal_hash_table_get_next_key_uint64(&hash_data, &key, (void**)&proc_data, node, (void**)&node)) { if (NULL != proc_data) { OBJ_RELEASE(proc_data); } } } OBJ_DESTRUCT(&hash_data); }
/* * Module cleanup. */ static void tcp_fini(void) { uint64_t ui64; char *nptr; mca_oob_tcp_peer_t *peer; /* cleanup all peers */ if (OPAL_SUCCESS == opal_hash_table_get_first_key_uint64(&mca_oob_tcp_module.peers, &ui64, (void**)&peer, (void**)&nptr)) { opal_output_verbose(2, orte_oob_base_framework.framework_output, "%s RELEASING PEER OBJ %s", ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), (NULL == peer) ? "NULL" : ORTE_NAME_PRINT(&peer->name)); if (NULL != peer) { OBJ_RELEASE(peer); } while (OPAL_SUCCESS == opal_hash_table_get_next_key_uint64(&mca_oob_tcp_module.peers, &ui64, (void**)&peer, nptr, (void**)&nptr)) { opal_output_verbose(2, orte_oob_base_framework.framework_output, "%s RELEASING PEER OBJ %s", ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), (NULL == peer) ? "NULL" : ORTE_NAME_PRINT(&peer->name)); if (NULL != peer) { OBJ_RELEASE(peer); } } } OBJ_DESTRUCT(&mca_oob_tcp_module.peers); if (mca_oob_tcp_module.ev_active) { /* if we used an independent progress thread at * the module level, stop it now */ opal_output_verbose(2, orte_oob_base_framework.framework_output, "%s STOPPING TCP PROGRESS THREAD", ORTE_NAME_PRINT(ORTE_PROC_MY_NAME)); /* stop the progress thread */ mca_oob_tcp_module.ev_active = false; /* break the event loop */ opal_event_base_loopexit(mca_oob_tcp_module.ev_base); /* wait for thread to exit */ opal_thread_join(&mca_oob_tcp_module.progress_thread, NULL); OBJ_DESTRUCT(&mca_oob_tcp_module.progress_thread); /* release the event base */ opal_event_base_free(mca_oob_tcp_module.ev_base); } }
static int orte_oob_base_close(void) { mca_oob_base_component_t *component; mca_base_component_list_item_t *cli; opal_object_t *value; uint64_t key; void *node; int rc; /* shutdown all active transports */ while (NULL != (cli = (mca_base_component_list_item_t *) opal_list_remove_first (&orte_oob_base.actives))) { component = (mca_oob_base_component_t*)cli->cli_component; if (NULL != component->shutdown) { component->shutdown(); } OBJ_RELEASE(cli); } /* destruct our internal lists */ OBJ_DESTRUCT(&orte_oob_base.actives); /* release all peers from the hash table */ rc = opal_hash_table_get_first_key_uint64 (&orte_oob_base.peers, &key, (void **) &value, &node); while (OPAL_SUCCESS == rc) { if (NULL != value) { OBJ_RELEASE(value); } rc = opal_hash_table_get_next_key_uint64 (&orte_oob_base.peers, &key, (void **) &value, node, &node); } OBJ_DESTRUCT(&orte_oob_base.peers); return mca_base_framework_components_close(&orte_oob_base_framework, NULL); }
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; }