2006-07-18 02:08:55 +04:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2004-2005 The Trustees of Indiana University.
|
|
|
|
* All rights reserved.
|
|
|
|
* Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
|
|
|
|
* All rights reserved.
|
|
|
|
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
|
|
|
* University of Stuttgart. All rights reserved.
|
|
|
|
* Copyright (c) 2004-2005 The Regents of the University of California.
|
|
|
|
* All rights reserved.
|
2007-05-24 19:41:24 +04:00
|
|
|
* Copyright (c) 2007 Los Alamos National Security, LLC. All rights
|
|
|
|
* reserved.
|
2006-07-18 02:08:55 +04:00
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "ompi_config.h"
|
|
|
|
|
|
|
|
#include "osc_rdma.h"
|
|
|
|
#include "osc_rdma_sendreq.h"
|
|
|
|
|
2006-10-13 02:52:13 +04:00
|
|
|
#include "opal/runtime/opal_progress.h"
|
2006-07-18 02:08:55 +04:00
|
|
|
#include "opal/threads/mutex.h"
|
|
|
|
#include "ompi/win/win.h"
|
|
|
|
#include "ompi/communicator/communicator.h"
|
|
|
|
#include "ompi/mca/btl/btl.h"
|
2006-11-28 01:42:21 +03:00
|
|
|
#include "ompi/mca/osc/base/base.h"
|
2006-07-18 02:08:55 +04:00
|
|
|
#include "mpi.h"
|
|
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
ompi_osc_rdma_module_free(ompi_win_t *win)
|
|
|
|
{
|
|
|
|
int ret = OMPI_SUCCESS;
|
2007-07-03 02:22:59 +04:00
|
|
|
int tmp, i;
|
2007-05-24 19:41:24 +04:00
|
|
|
ompi_osc_rdma_module_t *module = GET_MODULE(win);
|
2006-07-18 02:08:55 +04:00
|
|
|
|
2008-06-09 18:53:58 +04:00
|
|
|
opal_output_verbose(1, ompi_osc_base_output,
|
2007-05-24 19:41:24 +04:00
|
|
|
"rdma component destroying window with id %d",
|
2007-07-11 21:16:06 +04:00
|
|
|
ompi_comm_get_cid(module->m_comm));
|
2007-05-24 19:41:24 +04:00
|
|
|
|
2006-07-18 02:08:55 +04:00
|
|
|
/* finish with a barrier */
|
|
|
|
if (ompi_group_size(win->w_group) > 1) {
|
2007-08-19 07:37:49 +04:00
|
|
|
ret = module->m_comm->c_coll.coll_barrier(module->m_comm,
|
|
|
|
module->m_comm->c_coll.coll_barrier_module);
|
2006-07-18 02:08:55 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* remove from component information */
|
2007-05-24 19:41:24 +04:00
|
|
|
OPAL_THREAD_LOCK(&mca_osc_rdma_component.c_lock);
|
|
|
|
tmp = opal_hash_table_remove_value_uint32(&mca_osc_rdma_component.c_modules,
|
2007-07-11 21:16:06 +04:00
|
|
|
ompi_comm_get_cid(module->m_comm));
|
2006-07-18 02:08:55 +04:00
|
|
|
/* only take the output of hast_table_remove if there wasn't already an error */
|
|
|
|
ret = (ret != OMPI_SUCCESS) ? ret : tmp;
|
|
|
|
|
2007-05-24 19:41:24 +04:00
|
|
|
if (0 == opal_hash_table_get_size(&mca_osc_rdma_component.c_modules)) {
|
|
|
|
#if OMPI_ENABLE_PROGRESS_THREADS
|
|
|
|
void *foo;
|
2006-07-18 02:08:55 +04:00
|
|
|
|
2007-05-24 19:41:24 +04:00
|
|
|
mca_osc_rdma_component.c_thread_run = false;
|
|
|
|
opal_condition_broadcast(&ompi_request_cond);
|
|
|
|
opal_thread_join(&mca_osc_rdma_component.c_thread, &foo);
|
|
|
|
#else
|
|
|
|
opal_progress_unregister(ompi_osc_rdma_component_progress);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
OPAL_THREAD_UNLOCK(&mca_osc_rdma_component.c_lock);
|
2006-07-18 02:08:55 +04:00
|
|
|
|
2007-05-24 19:41:24 +04:00
|
|
|
win->w_osc_module = NULL;
|
2006-07-18 02:08:55 +04:00
|
|
|
|
2007-05-24 19:41:24 +04:00
|
|
|
OBJ_DESTRUCT(&module->m_unlocks_pending);
|
|
|
|
OBJ_DESTRUCT(&module->m_locks_pending);
|
2007-05-24 21:21:56 +04:00
|
|
|
OBJ_DESTRUCT(&module->m_queued_sendreqs);
|
2007-05-24 19:41:24 +04:00
|
|
|
OBJ_DESTRUCT(&module->m_copy_pending_sendreqs);
|
|
|
|
OBJ_DESTRUCT(&module->m_pending_sendreqs);
|
|
|
|
OBJ_DESTRUCT(&module->m_acc_lock);
|
|
|
|
OBJ_DESTRUCT(&module->m_cond);
|
|
|
|
OBJ_DESTRUCT(&module->m_lock);
|
2006-07-18 02:08:55 +04:00
|
|
|
|
2007-05-24 19:41:24 +04:00
|
|
|
if (NULL != module->m_sc_remote_ranks) {
|
|
|
|
free(module->m_sc_remote_ranks);
|
|
|
|
}
|
|
|
|
if (NULL != module->m_sc_remote_active_ranks) {
|
|
|
|
free(module->m_sc_remote_active_ranks);
|
|
|
|
}
|
|
|
|
if (NULL != module->m_fence_coll_counts) {
|
|
|
|
free(module->m_fence_coll_counts);
|
|
|
|
}
|
|
|
|
if (NULL != module->m_copy_num_pending_sendreqs) {
|
|
|
|
free(module->m_copy_num_pending_sendreqs);
|
|
|
|
}
|
|
|
|
if (NULL != module->m_num_pending_sendreqs) {
|
|
|
|
free(module->m_num_pending_sendreqs);
|
|
|
|
}
|
2007-07-03 02:22:59 +04:00
|
|
|
if (NULL != module->m_peer_info) {
|
|
|
|
for (i = 0 ; i < ompi_comm_size(module->m_comm) ; ++i) {
|
|
|
|
ompi_osc_rdma_peer_info_free(&module->m_peer_info[i]);
|
|
|
|
}
|
|
|
|
free(module->m_peer_info);
|
|
|
|
}
|
2007-05-24 19:41:24 +04:00
|
|
|
if (NULL != module->m_comm) ompi_comm_free(&module->m_comm);
|
|
|
|
if (NULL != module) free(module);
|
2006-07-18 02:08:55 +04:00
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
2007-07-03 02:22:59 +04:00
|
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
ompi_osc_rdma_peer_info_free(ompi_osc_rdma_peer_info_t *peer_info)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
if (NULL != peer_info->peer_btls) {
|
|
|
|
free(peer_info->peer_btls);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (NULL != peer_info->local_descriptors) {
|
|
|
|
for (i = 0 ; i < peer_info->local_num_btls ; ++i) {
|
|
|
|
if (NULL != peer_info->local_descriptors[i]) {
|
2008-10-01 01:02:37 +04:00
|
|
|
mca_bml_base_btl_t *bml_btl = peer_info->local_btls[i];
|
|
|
|
mca_btl_base_module_t* btl = bml_btl->btl;
|
|
|
|
|
|
|
|
btl->btl_free(btl, peer_info->local_descriptors[i]);
|
2007-07-03 02:22:59 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
free(peer_info->local_descriptors);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (NULL != peer_info->local_registrations) {
|
|
|
|
for (i = 0 ; i < peer_info->local_num_btls ; ++i) {
|
|
|
|
if (NULL != peer_info->local_registrations[i]) {
|
|
|
|
mca_mpool_base_module_t *module =
|
|
|
|
peer_info->local_registrations[i]->mpool;
|
|
|
|
module->mpool_deregister(module,
|
|
|
|
peer_info->local_registrations[i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
free(peer_info->local_registrations);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (NULL != peer_info->local_btls) {
|
|
|
|
free(peer_info->local_btls);
|
|
|
|
}
|
|
|
|
|
|
|
|
memset(peer_info, 0, sizeof(ompi_osc_rdma_peer_info_t));
|
|
|
|
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|