
This is a fairly intrusive change, but outside of the moving of opal/event to opal/mca/event, the only changes involved (a) changing all calls to opal_event functions to reflect the new framework instead, and (b) ensuring that all opal_event_t objects are properly constructed since they are now true opal_objects. Note: Shiqing has just returned from vacation and has not yet had a chance to complete the Windows integration. Thus, this commit almost certainly breaks Windows support on the trunk. However, I want this to have a chance to soak for as long as possible before I become less available a week from today (going to be at a class for 5 days, and thus will only be sparingly available) so we can find and fix any problems. Biggest change is moving the libevent code from opal/event to a new opal/mca/event framework. This was done to make it much easier to update libevent in the future. New versions can be inserted as a new component and tested in parallel with the current version until validated, then we can remove the earlier version if we so choose. This is a statically built framework ala installdirs, so only one component will build at a time. There is no selection logic - the sole compiled component simply loads its function pointers into the opal_event struct. I have gone thru the code base and converted all the libevent calls I could find. However, I cannot compile nor test every environment. It is therefore quite likely that errors remain in the system. Please keep an eye open for two things: 1. compile-time errors: these will be obvious as calls to the old functions (e.g., opal_evtimer_new) must be replaced by the new framework APIs (e.g., opal_event.evtimer_new) 2. run-time errors: these will likely show up as segfaults due to missing constructors on opal_event_t objects. It appears that it became a typical practice for people to "init" an opal_event_t by simply using memset to zero it out. This will no longer work - you must either OBJ_NEW or OBJ_CONSTRUCT an opal_event_t. I tried to catch these cases, but may have missed some. Believe me, you'll know when you hit it. There is also the issue of the new libevent "no recursion" behavior. As I described on a recent email, we will have to discuss this and figure out what, if anything, we need to do. This commit was SVN r23925.
157 строки
4.1 KiB
C
157 строки
4.1 KiB
C
/*
|
|
* Copyright (c) 2004-2010 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.
|
|
* 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 (c) 2008 Cisco Systems, Inc. All rights reserved.
|
|
* $COPYRIGHT$
|
|
*
|
|
* Additional copyrights may follow
|
|
*
|
|
* $HEADER$
|
|
*/
|
|
|
|
/** @file **/
|
|
|
|
#include "opal_config.h"
|
|
|
|
#include "opal/class/opal_object.h"
|
|
#include "opal/dss/dss.h"
|
|
#include "opal/util/trace.h"
|
|
#include "opal/util/output.h"
|
|
#include "opal/util/malloc.h"
|
|
#include "opal/util/net.h"
|
|
#include "opal/util/keyval_parse.h"
|
|
#include "opal/util/show_help.h"
|
|
#include "opal/memoryhooks/memory.h"
|
|
#include "opal/mca/base/base.h"
|
|
#include "opal/runtime/opal.h"
|
|
#include "opal/constants.h"
|
|
#include "opal/mca/if/base/base.h"
|
|
#include "opal/mca/installdirs/base/base.h"
|
|
#include "opal/mca/memcpy/base/base.h"
|
|
#include "opal/mca/memory/base/base.h"
|
|
#include "opal/mca/backtrace/base/base.h"
|
|
#include "opal/mca/timer/base/base.h"
|
|
#include "opal/mca/paffinity/base/base.h"
|
|
#include "opal/mca/event/base/base.h"
|
|
#include "opal/runtime/opal_progress.h"
|
|
#include "opal/mca/carto/base/base.h"
|
|
#if OPAL_ENABLE_FT_CR == 1
|
|
#include "opal/mca/compress/base/base.h"
|
|
#endif
|
|
|
|
#include "opal/runtime/opal_cr.h"
|
|
#include "opal/mca/crs/base/base.h"
|
|
|
|
extern int opal_initialized;
|
|
extern int opal_util_initialized;
|
|
|
|
int
|
|
opal_finalize_util(void)
|
|
{
|
|
if( --opal_util_initialized != 0 ) {
|
|
if( opal_util_initialized < 0 ) {
|
|
return OPAL_ERROR;
|
|
}
|
|
return OPAL_SUCCESS;
|
|
}
|
|
|
|
/* Clear out all the registered MCA params */
|
|
mca_base_param_finalize();
|
|
|
|
/* close interfaces code. */
|
|
opal_if_base_close();
|
|
|
|
opal_net_finalize();
|
|
|
|
/* keyval lex-based parser */
|
|
opal_util_keyval_parse_finalize();
|
|
|
|
opal_installdirs_base_close();
|
|
|
|
/* finalize the memory allocator */
|
|
opal_malloc_finalize();
|
|
|
|
/* finalize the trace system */
|
|
opal_trace_finalize();
|
|
|
|
/* finalize the show_help system */
|
|
opal_show_help_finalize();
|
|
|
|
/* 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();
|
|
|
|
/* close the dss */
|
|
opal_dss_close();
|
|
|
|
/* finalize the class/object system */
|
|
opal_class_finalize();
|
|
|
|
return OPAL_SUCCESS;
|
|
}
|
|
|
|
|
|
int
|
|
opal_finalize(void)
|
|
{
|
|
if( --opal_initialized != 0 ) {
|
|
if( opal_initialized < 0 ) {
|
|
return OPAL_ERROR;
|
|
}
|
|
return OPAL_SUCCESS;
|
|
}
|
|
|
|
/* close the checkpoint and restart service */
|
|
opal_cr_finalize();
|
|
|
|
#if OPAL_ENABLE_FT_CR == 1
|
|
opal_compress_base_close();
|
|
#endif
|
|
|
|
opal_progress_finalize();
|
|
|
|
opal_event_base_close();
|
|
|
|
/* close high resolution timers */
|
|
opal_timer_base_close();
|
|
|
|
opal_backtrace_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 carto framework */
|
|
opal_carto_base_close();
|
|
|
|
/* close the processor affinity base */
|
|
opal_paffinity_base_close();
|
|
|
|
/* close the memcpy base */
|
|
opal_memcpy_base_close();
|
|
|
|
/* finalize the mca */
|
|
mca_base_close();
|
|
|
|
/* finalize util code */
|
|
opal_finalize_util();
|
|
|
|
return OPAL_SUCCESS;
|
|
}
|