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.
|
2014-11-05 19:59:12 +03:00
|
|
|
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
2006-07-18 02:08:55 +04:00
|
|
|
* University of Stuttgart. All rights reserved.
|
|
|
|
* Copyright (c) 2004-2005 The Regents of the University of California.
|
|
|
|
* All rights reserved.
|
2016-06-03 03:22:40 +03:00
|
|
|
* Copyright (c) 2007-2016 Los Alamos National Security, LLC. All rights
|
2014-11-05 19:59:12 +03:00
|
|
|
* reserved.
|
2014-02-25 21:36:43 +04:00
|
|
|
* Copyright (c) 2012-2013 Sandia National Laboratories. All rights reserved.
|
2015-08-28 05:12:41 +03:00
|
|
|
* Copyright (c) 2015 Research Organization for Information Science
|
|
|
|
* and Technology (RIST). All rights reserved.
|
2006-07-18 02:08:55 +04:00
|
|
|
* $COPYRIGHT$
|
2014-11-05 19:59:12 +03:00
|
|
|
*
|
2006-07-18 02:08:55 +04:00
|
|
|
* Additional copyrights may follow
|
2014-11-05 19:59:12 +03:00
|
|
|
*
|
2006-07-18 02:08:55 +04:00
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
2014-11-05 19:59:12 +03:00
|
|
|
#include "osc_pt2pt.h"
|
2006-07-18 02:08:55 +04:00
|
|
|
|
|
|
|
|
2015-05-29 17:33:34 +03:00
|
|
|
int ompi_osc_pt2pt_attach(struct ompi_win_t *win, void *base, size_t len)
|
2014-02-25 21:36:43 +04:00
|
|
|
{
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int
|
2015-08-28 05:12:41 +03:00
|
|
|
ompi_osc_pt2pt_detach(struct ompi_win_t *win, const void *base)
|
2014-02-25 21:36:43 +04:00
|
|
|
{
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-05-29 17:33:34 +03:00
|
|
|
int ompi_osc_pt2pt_free(ompi_win_t *win)
|
2006-07-18 02:08:55 +04:00
|
|
|
{
|
|
|
|
int ret = OMPI_SUCCESS;
|
2014-11-05 19:59:12 +03:00
|
|
|
ompi_osc_pt2pt_module_t *module = GET_MODULE(win);
|
2015-05-29 17:33:34 +03:00
|
|
|
ompi_osc_pt2pt_peer_t *peer;
|
|
|
|
uint32_t key;
|
|
|
|
void *node;
|
2014-02-25 21:36:43 +04:00
|
|
|
|
2014-04-28 23:55:18 +04:00
|
|
|
if (NULL == module) {
|
|
|
|
return OMPI_SUCCESS;
|
2006-07-18 02:08:55 +04:00
|
|
|
}
|
|
|
|
|
2014-04-28 23:55:18 +04:00
|
|
|
if (NULL != module->comm) {
|
|
|
|
opal_output_verbose(1, ompi_osc_base_framework.framework_output,
|
2014-11-05 19:59:12 +03:00
|
|
|
"pt2pt component destroying window with id %d",
|
2014-04-28 23:55:18 +04:00
|
|
|
ompi_comm_get_cid(module->comm));
|
|
|
|
|
|
|
|
/* finish with a barrier */
|
|
|
|
if (ompi_group_size(win->w_group) > 1) {
|
2015-09-22 18:06:25 +03:00
|
|
|
(void) module->comm->c_coll.coll_barrier (module->comm,
|
|
|
|
module->comm->c_coll.coll_barrier_module);
|
2014-04-28 23:55:18 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* remove from component information */
|
2014-11-14 01:13:10 +03:00
|
|
|
OPAL_THREAD_SCOPED_LOCK(&mca_osc_pt2pt_component.lock,
|
|
|
|
opal_hash_table_remove_value_uint32(&mca_osc_pt2pt_component.modules,
|
|
|
|
ompi_comm_get_cid(module->comm)));
|
2014-04-28 23:55:18 +04:00
|
|
|
}
|
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);
|
2014-11-14 01:13:10 +03:00
|
|
|
OBJ_DESTRUCT(&module->locks_pending_lock);
|
2014-02-25 21:36:43 +04:00
|
|
|
OBJ_DESTRUCT(&module->cond);
|
|
|
|
OBJ_DESTRUCT(&module->lock);
|
2015-05-29 17:33:34 +03:00
|
|
|
OBJ_DESTRUCT(&module->all_sync);
|
2014-02-25 21:36:43 +04:00
|
|
|
|
|
|
|
/* it is erroneous to close a window with active operations on it so we should
|
|
|
|
* probably produce an error here instead of cleaning up */
|
2014-11-14 01:13:10 +03:00
|
|
|
OPAL_LIST_DESTRUCT(&module->pending_acc);
|
2014-06-17 19:23:06 +04:00
|
|
|
|
2014-11-14 01:13:10 +03:00
|
|
|
osc_pt2pt_gc_clean (module);
|
|
|
|
OPAL_LIST_DESTRUCT(&module->buffer_gc);
|
|
|
|
OBJ_DESTRUCT(&module->gc_lock);
|
2007-07-03 02:22:59 +04:00
|
|
|
|
2015-05-29 17:33:34 +03:00
|
|
|
ret = opal_hash_table_get_first_key_uint32 (&module->peer_hash, &key, (void **) &peer, &node);
|
|
|
|
while (OPAL_SUCCESS == ret) {
|
|
|
|
OBJ_RELEASE(peer);
|
|
|
|
ret = opal_hash_table_get_next_key_uint32 (&module->peer_hash, &key, (void **) &peer, node,
|
|
|
|
&node);
|
2007-07-03 02:22:59 +04:00
|
|
|
}
|
2014-11-14 01:13:10 +03:00
|
|
|
|
2015-05-29 17:33:34 +03:00
|
|
|
OBJ_DESTRUCT(&module->peer_hash);
|
|
|
|
OBJ_DESTRUCT(&module->peer_lock);
|
|
|
|
|
2016-08-09 15:49:48 +03:00
|
|
|
if (NULL != module->recv_frags) {
|
2016-08-23 01:35:27 +03:00
|
|
|
for (unsigned int i = 0 ; i < module->recv_frag_count ; ++i) {
|
2016-08-09 15:49:48 +03:00
|
|
|
OBJ_DESTRUCT(module->recv_frags + i);
|
|
|
|
}
|
2014-11-14 01:13:10 +03:00
|
|
|
|
2016-08-09 15:49:48 +03:00
|
|
|
free (module->recv_frags);
|
2014-04-28 23:55:18 +04:00
|
|
|
}
|
2016-06-03 03:22:40 +03:00
|
|
|
|
2016-08-09 15:49:48 +03:00
|
|
|
if (NULL != module->epoch_outgoing_frag_count) free(module->epoch_outgoing_frag_count);
|
|
|
|
|
2014-04-28 23:55:18 +04:00
|
|
|
if (NULL != module->comm) {
|
|
|
|
ompi_comm_free(&module->comm);
|
2007-07-03 02:22:59 +04:00
|
|
|
}
|
2016-08-09 15:49:48 +03:00
|
|
|
|
2014-04-28 23:55:18 +04:00
|
|
|
if (NULL != module->free_after) free(module->free_after);
|
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
|
|
|
|
2015-05-29 17:33:34 +03:00
|
|
|
return OMPI_SUCCESS;
|
2007-07-03 02:22:59 +04:00
|
|
|
}
|