2007-12-21 09:02:00 +03:00
|
|
|
/* -*- Mode: C; c-basic-offset:4 ; -*- */
|
2004-06-15 23:07:45 +04:00
|
|
|
/*
|
2005-11-05 22:57:48 +03:00
|
|
|
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
|
|
|
* University Research and Technology
|
|
|
|
* Corporation. All rights reserved.
|
2007-12-21 09:02:00 +03:00
|
|
|
* Copyright (c) 2004-2007 The University of Tennessee and The University
|
2005-11-05 22:57:48 +03:00
|
|
|
* of Tennessee Research Foundation. All rights
|
|
|
|
* reserved.
|
2004-11-28 23:09:25 +03:00
|
|
|
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
|
|
|
* University of Stuttgart. All rights reserved.
|
2005-03-24 15:43:37 +03:00
|
|
|
* Copyright (c) 2004-2005 The Regents of the University of California.
|
|
|
|
* All rights reserved.
|
2009-04-14 03:41:45 +04:00
|
|
|
* Copyright (c) 2008-2009 Cisco Systems, Inc. All rights reserved.
|
2004-11-22 04:38:40 +03:00
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
2004-06-15 23:07:45 +04:00
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "ompi_config.h"
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
2006-02-12 04:33:29 +03:00
|
|
|
#include "ompi/constants.h"
|
|
|
|
#include "opal/mca/mca.h"
|
|
|
|
#include "opal/mca/base/base.h"
|
|
|
|
#include "ompi/mca/mpool/base/base.h"
|
2005-09-14 06:17:04 +04:00
|
|
|
#include "mpool_base_mem_cb.h"
|
2004-06-15 23:07:45 +04:00
|
|
|
|
2005-09-17 02:22:03 +04:00
|
|
|
|
2004-06-15 23:07:45 +04:00
|
|
|
int mca_mpool_base_close(void)
|
|
|
|
{
|
2005-07-03 20:22:16 +04:00
|
|
|
opal_list_item_t *item;
|
2004-06-15 23:07:45 +04:00
|
|
|
mca_mpool_base_selected_module_t *sm;
|
2006-03-16 19:56:22 +03:00
|
|
|
int32_t modules_length;
|
|
|
|
|
|
|
|
/* Need the initial length in order to know if some of the initializations
|
|
|
|
* are done in the open function.
|
|
|
|
*/
|
|
|
|
modules_length = opal_list_get_size(&mca_mpool_base_modules);
|
2004-06-15 23:07:45 +04:00
|
|
|
|
2004-08-02 04:24:22 +04:00
|
|
|
/* Finalize all the mpool components and free their list items */
|
2004-06-15 23:07:45 +04:00
|
|
|
|
2005-07-03 20:22:16 +04:00
|
|
|
for (item = opal_list_remove_first(&mca_mpool_base_modules);
|
2004-06-15 23:07:45 +04:00
|
|
|
NULL != item;
|
2005-07-03 20:22:16 +04:00
|
|
|
item = opal_list_remove_first(&mca_mpool_base_modules)) {
|
2004-06-15 23:07:45 +04:00
|
|
|
sm = (mca_mpool_base_selected_module_t *) item;
|
|
|
|
|
|
|
|
/* Blatently ignore the return code (what would we do to recover,
|
2004-08-02 04:24:22 +04:00
|
|
|
anyway? This component is going away, so errors don't matter
|
2005-01-15 16:20:26 +03:00
|
|
|
anymore). Note that it's legal for the module to have NULL for
|
|
|
|
the finalize function. */
|
2004-06-15 23:07:45 +04:00
|
|
|
|
2005-01-15 16:20:26 +03:00
|
|
|
if (NULL != sm->mpool_module->mpool_finalize) {
|
|
|
|
sm->mpool_module->mpool_finalize(sm->mpool_module);
|
|
|
|
}
|
2005-01-15 00:58:02 +03:00
|
|
|
OBJ_RELEASE(sm);
|
2004-06-15 23:07:45 +04:00
|
|
|
}
|
|
|
|
|
2004-08-02 04:24:22 +04:00
|
|
|
/* Close all remaining available components (may be one if this is a
|
2004-06-15 23:07:45 +04:00
|
|
|
OMPI RTE program, or [possibly] multiple if this is ompi_info) */
|
|
|
|
|
2004-08-02 04:24:22 +04:00
|
|
|
mca_base_components_close(mca_mpool_base_output,
|
|
|
|
&mca_mpool_base_components, NULL);
|
2004-06-15 23:07:45 +04:00
|
|
|
|
2005-09-14 06:17:04 +04:00
|
|
|
/* deregister memory free callback */
|
2008-07-25 02:51:26 +04:00
|
|
|
if( (modules_length > 0) && mca_mpool_base_used_mem_hooks &&
|
2005-11-29 07:46:14 +03:00
|
|
|
0 != (OPAL_MEMORY_FREE_SUPPORT & opal_mem_hooks_support_level())) {
|
|
|
|
opal_mem_hooks_unregister_release(mca_mpool_base_mem_cb);
|
2005-09-17 02:22:03 +04:00
|
|
|
}
|
2004-06-15 23:07:45 +04:00
|
|
|
/* All done */
|
|
|
|
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|