2006-01-28 18:38:37 +03: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.
|
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "ompi_config.h"
|
|
|
|
|
|
|
|
#include "osc_pt2pt.h"
|
|
|
|
#include "osc_pt2pt_sendreq.h"
|
|
|
|
|
2006-10-13 02:52:13 +04:00
|
|
|
#include "opal/runtime/opal_progress.h"
|
2006-01-28 18:38:37 +03:00
|
|
|
#include "opal/threads/mutex.h"
|
|
|
|
#include "ompi/win/win.h"
|
|
|
|
#include "ompi/communicator/communicator.h"
|
|
|
|
#include "mpi.h"
|
|
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
ompi_osc_pt2pt_module_free(ompi_win_t *win)
|
|
|
|
{
|
|
|
|
int ret = OMPI_SUCCESS;
|
2006-02-07 15:16:23 +03:00
|
|
|
int tmp;
|
2006-01-28 18:38:37 +03:00
|
|
|
ompi_osc_pt2pt_module_t *module = P2P_MODULE(win);
|
|
|
|
|
2006-10-13 02:52:13 +04:00
|
|
|
while (OMPI_WIN_EXPOSE_EPOCH & ompi_win_get_mode(win)) {
|
|
|
|
opal_progress();
|
|
|
|
}
|
|
|
|
|
2006-01-28 18:38:37 +03:00
|
|
|
/* finish with a barrier */
|
|
|
|
if (ompi_group_size(win->w_group) > 1) {
|
|
|
|
ret = module->p2p_comm->c_coll.coll_barrier(module->p2p_comm);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* remove window information */
|
|
|
|
win->w_osc_module = NULL;
|
|
|
|
|
|
|
|
/* remove from component information */
|
|
|
|
OPAL_THREAD_LOCK(&mca_osc_pt2pt_component.p2p_c_lock);
|
|
|
|
tmp = opal_hash_table_remove_value_uint32(&mca_osc_pt2pt_component.p2p_c_modules,
|
|
|
|
module->p2p_comm->c_contextid);
|
|
|
|
/* only take the output of hast_table_remove if there wasn't already an error */
|
|
|
|
ret = (ret != OMPI_SUCCESS) ? ret : tmp;
|
2006-08-03 04:10:19 +04:00
|
|
|
|
|
|
|
if (0 == opal_hash_table_get_size(&mca_osc_pt2pt_component.p2p_c_modules)) {
|
|
|
|
/* stop progress thread */
|
|
|
|
opal_progress_unregister(ompi_osc_pt2pt_progress);
|
|
|
|
}
|
|
|
|
|
2006-01-28 18:38:37 +03:00
|
|
|
OPAL_THREAD_UNLOCK(&mca_osc_pt2pt_component.p2p_c_lock);
|
|
|
|
|
2006-02-07 21:45:18 +03:00
|
|
|
OBJ_DESTRUCT(&(module->p2p_locks_pending));
|
|
|
|
|
2006-09-22 00:49:15 +04:00
|
|
|
free(module->p2p_sc_remote_ranks);
|
|
|
|
free(module->p2p_sc_remote_active_ranks);
|
2006-02-07 15:16:23 +03:00
|
|
|
assert(module->p2p_sc_group == NULL);
|
|
|
|
assert(module->p2p_pw_group == NULL);
|
|
|
|
free(module->p2p_fence_coll_counts);
|
|
|
|
|
|
|
|
free(module->p2p_copy_num_pending_sendreqs);
|
|
|
|
OBJ_DESTRUCT(&(module->p2p_copy_pending_sendreqs));
|
|
|
|
|
|
|
|
OBJ_DESTRUCT(&(module->p2p_long_msgs));
|
|
|
|
|
|
|
|
free(module->p2p_num_pending_sendreqs);
|
|
|
|
|
|
|
|
OBJ_DESTRUCT(&(module->p2p_pending_sendreqs));
|
2006-01-28 18:38:37 +03:00
|
|
|
|
2006-08-03 04:10:19 +04:00
|
|
|
OBJ_DESTRUCT(&(module->p2p_pending_control_sends));
|
|
|
|
|
2006-01-28 18:38:37 +03:00
|
|
|
ompi_comm_free(&(module->p2p_comm));
|
|
|
|
module->p2p_comm = NULL;
|
|
|
|
|
|
|
|
module->p2p_win = NULL;
|
|
|
|
|
|
|
|
OBJ_DESTRUCT(&(module->p2p_acc_lock));
|
|
|
|
OBJ_DESTRUCT(&(module->p2p_lock));
|
|
|
|
|
|
|
|
free(module);
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|