2005-05-19 17:33:55 +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.
|
|
|
|
* Copyright (c) 2004-2005 The University of Tennessee and The University
|
|
|
|
* of Tennessee Research Foundation. All rights
|
|
|
|
* reserved.
|
2005-09-07 22:52:28 +04:00
|
|
|
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
2005-05-19 17:33:55 +04:00
|
|
|
* University of Stuttgart. All rights reserved.
|
|
|
|
* Copyright (c) 2004-2005 The Regents of the University of California.
|
|
|
|
* All rights reserved.
|
|
|
|
* $COPYRIGHT$
|
2005-09-07 22:52:28 +04:00
|
|
|
*
|
2005-05-19 17:33:55 +04:00
|
|
|
* Additional copyrights may follow
|
2005-09-07 22:52:28 +04:00
|
|
|
*
|
2005-05-19 17:33:55 +04:00
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
|
|
|
/** @file **/
|
|
|
|
|
2006-02-12 04:33:29 +03:00
|
|
|
#include "opal_config.h"
|
2005-05-19 17:33:55 +04:00
|
|
|
|
2005-07-03 20:06:07 +04:00
|
|
|
#include "opal/class/opal_object.h"
|
2005-09-07 22:52:28 +04:00
|
|
|
#include "opal/util/trace.h"
|
2005-07-04 03:31:27 +04:00
|
|
|
#include "opal/util/output.h"
|
2005-07-04 05:36:20 +04:00
|
|
|
#include "opal/util/malloc.h"
|
2005-08-25 00:27:45 +04:00
|
|
|
#include "opal/util/if.h"
|
2006-01-16 04:48:03 +03:00
|
|
|
#include "opal/util/keyval_parse.h"
|
2005-11-11 03:26:27 +03:00
|
|
|
#include "opal/memoryhooks/memory.h"
|
2005-08-13 00:46:25 +04:00
|
|
|
#include "opal/mca/base/base.h"
|
|
|
|
#include "opal/runtime/opal.h"
|
2006-02-12 04:33:29 +03:00
|
|
|
#include "opal/constants.h"
|
2006-04-05 09:57:51 +04:00
|
|
|
#include "opal/mca/memcpy/base/base.h"
|
2005-08-14 21:23:34 +04:00
|
|
|
#include "opal/mca/memory/base/base.h"
|
2005-08-18 09:34:22 +04:00
|
|
|
#include "opal/mca/timer/base/base.h"
|
2005-08-25 00:19:36 +04:00
|
|
|
#include "opal/mca/paffinity/base/base.h"
|
2005-05-19 17:33:55 +04:00
|
|
|
|
2006-01-16 04:48:03 +03:00
|
|
|
int
|
|
|
|
opal_finalize_util(void)
|
2005-05-19 17:33:55 +04:00
|
|
|
{
|
2006-01-16 04:48:03 +03:00
|
|
|
/* Clear out all the registered MCA params */
|
|
|
|
mca_base_param_finalize();
|
|
|
|
|
2005-08-25 00:27:45 +04:00
|
|
|
/* close interfaces code. This is lazy opened, but protected from
|
|
|
|
close when not opened internally */
|
|
|
|
opal_iffinalize();
|
|
|
|
|
2006-01-16 04:48:03 +03:00
|
|
|
/* keyval lex-based parser */
|
|
|
|
opal_util_keyval_parse_finalize();
|
2005-09-07 22:52:28 +04:00
|
|
|
|
2005-05-19 17:33:55 +04:00
|
|
|
/* finalize the memory allocator */
|
2005-07-04 05:36:20 +04:00
|
|
|
opal_malloc_finalize();
|
2005-05-19 17:33:55 +04:00
|
|
|
|
2005-09-07 22:52:28 +04:00
|
|
|
/* finalize the trace system */
|
|
|
|
opal_trace_finalize();
|
|
|
|
|
2005-08-25 00:19:36 +04:00
|
|
|
/* finalize the output system. This has to come *after* the
|
|
|
|
malloc code, as the malloc code needs to call into this, but
|
|
|
|
the malloc code turning off doesn't affect opal_output that
|
|
|
|
much */
|
|
|
|
opal_output_finalize();
|
|
|
|
|
|
|
|
/* finalize the class/object system */
|
|
|
|
opal_class_finalize();
|
|
|
|
|
2006-01-16 04:48:03 +03:00
|
|
|
return OPAL_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2006-08-22 00:07:38 +04:00
|
|
|
extern int opal_initialized;
|
2006-01-16 04:48:03 +03:00
|
|
|
|
|
|
|
int
|
|
|
|
opal_finalize(void)
|
|
|
|
{
|
2006-08-22 00:07:38 +04:00
|
|
|
if( --opal_initialized != 0 ) {
|
|
|
|
if( opal_initialized < 0 ) {
|
|
|
|
return OPAL_ERROR;
|
|
|
|
}
|
|
|
|
return OPAL_SUCCESS;
|
|
|
|
}
|
2006-01-16 04:48:03 +03:00
|
|
|
/* close high resolution timers */
|
|
|
|
opal_timer_base_close();
|
|
|
|
|
|
|
|
/* close the memory manager components. Registered hooks can
|
|
|
|
still be fired any time between now and the call to
|
|
|
|
opal_mem_free_finalize(), and callbacks from the memory manager
|
|
|
|
hooks to the bowels of the mem_free code can still occur any
|
|
|
|
time between now and end of application (even post main()!) */
|
|
|
|
opal_memory_base_close();
|
|
|
|
|
|
|
|
/* finalize the memory manager / tracker */
|
|
|
|
opal_mem_hooks_finalize();
|
|
|
|
|
|
|
|
/* close the processor affinity base */
|
|
|
|
opal_paffinity_base_close();
|
|
|
|
|
2006-04-05 09:57:51 +04:00
|
|
|
/* close the memcpy base */
|
|
|
|
opal_memcpy_base_close();
|
|
|
|
|
2006-01-16 04:48:03 +03:00
|
|
|
/* finalize the mca */
|
|
|
|
mca_base_close();
|
|
|
|
|
|
|
|
/* finalize util code */
|
|
|
|
opal_finalize_util();
|
|
|
|
|
2006-02-12 04:33:29 +03:00
|
|
|
return OPAL_SUCCESS;
|
2005-05-19 17:33:55 +04:00
|
|
|
}
|