2014-02-25 21:36:43 +04:00
|
|
|
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
|
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.
|
2014-02-25 21:36:43 +04:00
|
|
|
* Copyright (c) 2007-2014 Los Alamos National Security, LLC. All rights
|
2007-05-24 19:41:24 +04:00
|
|
|
* reserved.
|
2014-02-25 21:36:43 +04:00
|
|
|
* Copyright (c) 2012-2013 Sandia National Laboratories. 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 "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
|
2014-02-25 21:36:43 +04:00
|
|
|
ompi_osc_rdma_attach(struct ompi_win_t *win, void *base, size_t len)
|
|
|
|
{
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
ompi_osc_rdma_detach(struct ompi_win_t *win, void *base)
|
|
|
|
{
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
ompi_osc_rdma_free(ompi_win_t *win)
|
2006-07-18 02:08:55 +04:00
|
|
|
{
|
|
|
|
int ret = OMPI_SUCCESS;
|
2007-05-24 19:41:24 +04:00
|
|
|
ompi_osc_rdma_module_t *module = GET_MODULE(win);
|
2014-02-25 21:36:43 +04:00
|
|
|
opal_list_item_t *item;
|
|
|
|
|
|
|
|
assert (NULL != module);
|
2006-07-18 02:08:55 +04:00
|
|
|
|
2013-03-28 01:17:31 +04:00
|
|
|
opal_output_verbose(1, ompi_osc_base_framework.framework_output,
|
2007-05-24 19:41:24 +04:00
|
|
|
"rdma component destroying window with id %d",
|
2014-02-25 21:36:43 +04:00
|
|
|
ompi_comm_get_cid(module->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) {
|
2014-02-25 21:36:43 +04:00
|
|
|
ret = module->comm->c_coll.coll_barrier(module->comm,
|
|
|
|
module->comm->c_coll.coll_barrier_module);
|
2006-07-18 02:08:55 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* remove from component information */
|
2014-02-25 21:36:43 +04:00
|
|
|
OPAL_THREAD_LOCK(&mca_osc_rdma_component.lock);
|
|
|
|
opal_hash_table_remove_value_uint32(&mca_osc_rdma_component.modules,
|
|
|
|
ompi_comm_get_cid(module->comm));
|
|
|
|
OPAL_THREAD_UNLOCK(&mca_osc_rdma_component.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
|
|
|
|
2014-02-25 21:36:43 +04:00
|
|
|
OBJ_DESTRUCT(&module->outstanding_locks);
|
|
|
|
OBJ_DESTRUCT(&module->locks_pending);
|
|
|
|
OBJ_DESTRUCT(&module->acc_lock);
|
|
|
|
OBJ_DESTRUCT(&module->cond);
|
|
|
|
OBJ_DESTRUCT(&module->lock);
|
|
|
|
|
|
|
|
/* it is erroneous to close a window with active operations on it so we should
|
|
|
|
* probably produce an error here instead of cleaning up */
|
|
|
|
while (NULL != (item = opal_list_remove_first (&module->pending_acc))) {
|
|
|
|
OBJ_RELEASE(item);
|
2007-07-03 02:22:59 +04:00
|
|
|
}
|
2006-07-18 02:08:55 +04:00
|
|
|
|
2014-02-25 21:36:43 +04:00
|
|
|
OBJ_DESTRUCT(&module->pending_acc);
|
2007-07-03 02:22:59 +04:00
|
|
|
|
2014-02-25 21:36:43 +04:00
|
|
|
osc_rdma_request_gc_clean (module);
|
|
|
|
assert (0 == opal_list_get_size (&module->request_gc));
|
|
|
|
OBJ_DESTRUCT(&module->request_gc);
|
2007-07-03 02:22:59 +04:00
|
|
|
|
2014-02-25 21:36:43 +04:00
|
|
|
if (NULL != module->peers) {
|
|
|
|
free(module->peers);
|
2007-07-03 02:22:59 +04:00
|
|
|
}
|
2014-02-25 21:36:43 +04:00
|
|
|
if (NULL != module->passive_eager_send_active) free(module->passive_eager_send_active);
|
|
|
|
if (NULL != module->passive_incoming_frag_count) free(module->passive_incoming_frag_count);
|
|
|
|
if (NULL != module->passive_incoming_frag_signal_count) free(module->passive_incoming_frag_signal_count);
|
|
|
|
if (NULL != module->epoch_outgoing_frag_count) free(module->epoch_outgoing_frag_count);
|
|
|
|
if (NULL != module->incomming_buffer) free (module->incomming_buffer);
|
|
|
|
if (NULL != module->comm) ompi_comm_free(&module->comm);
|
|
|
|
if (NULL != module->free_after) free(module->free_after);
|
|
|
|
|
|
|
|
if (NULL != module->frag_request) {
|
|
|
|
module->frag_request->req_complete_cb = NULL;
|
|
|
|
ompi_request_cancel (module->frag_request);
|
2007-07-03 02:22:59 +04:00
|
|
|
}
|
|
|
|
|
2014-02-25 21:36:43 +04:00
|
|
|
free (module);
|
2007-07-03 02:22:59 +04:00
|
|
|
|
2014-02-25 21:36:43 +04:00
|
|
|
return ret;
|
2007-07-03 02:22:59 +04:00
|
|
|
}
|