int shmem_transport_fini(void) { ptl_ct_event_t ct; /* synchronize the atomic cache, if there is one */ PtlAtomicSync(); /* wait for remote completion (acks) of all pending events */ PtlCTWait(shmem_transport_portals4_put_ct_h, shmem_transport_portals4_pending_put_counter, &ct); if (shmem_transport_portals4_pending_put_counter != ct.success + ct.failure) { fprintf(stderr, "[%03d] WARNING: put count mismatch: %ld, %ld\n", shmem_internal_my_pe, (long) shmem_transport_portals4_pending_put_counter, (long) (ct.success + ct.failure)); } PtlCTWait(shmem_transport_portals4_get_ct_h, shmem_transport_portals4_pending_get_counter, &ct); if (shmem_transport_portals4_pending_get_counter != ct.success + ct.failure) { fprintf(stderr, "[%03d] WARNING: get count mismatch: %ld, %ld\n", shmem_internal_my_pe, (long) shmem_transport_portals4_pending_get_counter, (long) (ct.success + ct.failure)); } cleanup_handles(); PtlFini(); SHMEM_MUTEX_DESTROY(shmem_internal_mutex_ptl4_pt_state); SHMEM_MUTEX_DESTROY(shmem_internal_mutex_ptl4_frag); SHMEM_MUTEX_DESTROY(shmem_internal_mutex_ptl4_event_slots); SHMEM_MUTEX_DESTROY(shmem_internal_mutex_ptl4_nb_fence); return 0; }
static void shmem_internal_shutdown(int barrier_requested) { if (!shmem_internal_initialized || shmem_internal_finalized) { return; } shmem_internal_finalized = 1; if (barrier_requested) shmem_internal_barrier_all(); shmem_transport_fini(); #ifdef USE_XPMEM shmem_transport_xpmem_fini(); #endif #ifdef USE_CMA shmem_transport_cma_fini(); #endif SHMEM_MUTEX_DESTROY(shmem_internal_mutex_alloc); shmem_internal_symmetric_fini(); shmem_runtime_fini(); }
void shmem_free_list_destroy(shmem_free_list_t *fl) { shmem_free_list_alloc_t *alloc, *next; alloc = fl->allocs; while (NULL != alloc) { next = alloc->next; free(alloc); alloc = next; } SHMEM_MUTEX_DESTROY(fl->lock); }
int shmem_transport_fini(void) { /* Wait for acks before shutdown */ shmem_transport_quiet(); if (shmem_transport_ofi_epfd && fi_close(&shmem_transport_ofi_epfd->fid)) { OFI_ERRMSG("Endpoint close failed (%s)", fi_strerror(errno)); } if (shmem_transport_ofi_cntr_epfd && fi_close(&shmem_transport_ofi_cntr_epfd->fid)) { OFI_ERRMSG("Endpoint close failed (%s)", fi_strerror(errno)); } if (shmem_transport_ofi_stx && fi_close(&shmem_transport_ofi_stx->fid)) { OFI_ERRMSG("Shared context close failed (%s)", fi_strerror(errno)); } #if defined(ENABLE_MR_SCALABLE) && defined(ENABLE_REMOTE_VIRTUAL_ADDRESSING) if (shmem_transport_ofi_target_mrfd && fi_close(&shmem_transport_ofi_target_mrfd->fid)) { OFI_ERRMSG("Target MR close failed (%s)", fi_strerror(errno)); } #else if (shmem_transport_ofi_target_heap_mrfd && fi_close(&shmem_transport_ofi_target_heap_mrfd->fid)) { OFI_ERRMSG("Target heap MR close failed (%s)", fi_strerror(errno)); } if (shmem_transport_ofi_target_data_mrfd && fi_close(&shmem_transport_ofi_target_data_mrfd->fid)) { OFI_ERRMSG("Target data MR close failed (%s)", fi_strerror(errno)); } #endif if (shmem_transport_ofi_put_nb_cqfd && fi_close(&shmem_transport_ofi_put_nb_cqfd->fid)) { OFI_ERRMSG("Write CQ close failed (%s)", fi_strerror(errno)); } if(shmem_transport_ofi_put_cntrfd && fi_close(&shmem_transport_ofi_put_cntrfd->fid)){ OFI_ERRMSG("INJECT PUT CT close failed (%s)", fi_strerror(errno)); } if(shmem_transport_ofi_get_cntrfd && fi_close(&shmem_transport_ofi_get_cntrfd->fid)){ OFI_ERRMSG("GET CT close failed (%s)", fi_strerror(errno)); } #ifndef ENABLE_HARD_POLLING if(shmem_transport_ofi_target_cntrfd && fi_close(&shmem_transport_ofi_target_cntrfd->fid)){ OFI_ERRMSG("Target CT close failed (%s)", fi_strerror(errno)); } #endif if (shmem_transport_ofi_avfd && fi_close(&shmem_transport_ofi_avfd->fid)) { OFI_ERRMSG("AV close failed (%s)", fi_strerror(errno)); } if (shmem_transport_ofi_domainfd && fi_close(&shmem_transport_ofi_domainfd->fid)) { OFI_ERRMSG("Domain close failed (%s)", fi_strerror(errno)); } if (shmem_transport_ofi_fabfd && fi_close(&shmem_transport_ofi_fabfd->fid)) { OFI_ERRMSG("Fabric close failed (%s)", fi_strerror(errno)); } if (NULL != shmem_transport_ofi_bounce_buffers) { shmem_free_list_destroy(shmem_transport_ofi_bounce_buffers); } #ifdef USE_AV_MAP free(addr_table); #endif SHMEM_MUTEX_DESTROY(shmem_transport_ofi_lock); return 0; }