1
1

Add the ability to use an external version of libevent. Clearly not recommended at this time. I've verified that it works in limited scenarios, but more thorough testing and performance impacts need to be assessed.

Interesting how many includes had to be fixed here and there to fill in missing dependencies :-)

This commit was SVN r28411.
Этот коммит содержится в:
Ralph Castain 2013-04-29 17:02:37 +00:00
родитель 3052acd968
Коммит 5d7a93c032
17 изменённых файлов: 374 добавлений и 1 удалений

Просмотреть файл

@ -40,7 +40,7 @@
#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>
#endif
#include <unistd.h>
void mca_fs_base_get_parent_dir ( char *filename, char **dirnamep)
{

Просмотреть файл

@ -42,6 +42,7 @@
#include "opal/runtime/opal_progress.h"
#include "opal/threads/threads.h"
#include "opal/util/arch.h"
#include "opal/util/argv.h"
#include "opal/util/output.h"
#include "opal/util/error.h"
#include "opal/util/stacktrace.h"

Просмотреть файл

@ -46,6 +46,7 @@
#endif
#include "opal/mca/base/base.h"
#include "opal/runtime/opal_info_support.h"
#include "opal/util/argv.h"
#include "opal/util/show_help.h"
#if OMPI_RTE_ORTE

Просмотреть файл

@ -52,6 +52,7 @@
#include "opal_config.h"
#include "opal/prefetch.h"
#include "opal/class/opal_object.h"
#include "opal/mca/event/event.h"

18
opal/mca/event/external/Makefile.am поставляемый Обычный файл
Просмотреть файл

@ -0,0 +1,18 @@
#
# Copyright (c) 2011-2012 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2013 Los Alamos National Security, LLC. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
# We only ever build this component statically
noinst_LTLIBRARIES = libmca_event_external.la
libmca_event_external_la_SOURCES = \
external.h \
event_external_component.c \
event_external_module.c
libmca_event_external_la_CPPFLAGS = $(opal_event_external_CPPFLAGS)

133
opal/mca/event/external/configure.m4 поставляемый Обычный файл
Просмотреть файл

@ -0,0 +1,133 @@
# -*- shell-script -*-
#
# Copyright (c) 2009-2013 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2013 Los Alamos National Security, LLC. All rights reserved.
#
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
#
# Priority
#
AC_DEFUN([MCA_opal_event_external_PRIORITY], [90])
#
# Force this component to compile in static-only mode
#
AC_DEFUN([MCA_opal_event_external_COMPILE_MODE], [
AC_MSG_CHECKING([for MCA component $2:$3 compile mode])
$4="static"
AC_MSG_RESULT([$$4])
])
# MCA_event_external_POST_CONFIG()
# ---------------------------------
AC_DEFUN([MCA_opal_event_external_POST_CONFIG],[
# If we won, then do all the rest of the setup
AS_IF([test "$1" = "1"],
[AC_DEFINE_UNQUOTED([EVENT_EXTERNAL_EVENT_VERSION],
[external],
[Version of event])
# Set this variable so that the framework m4 knows what
# file to include in opal/mca/event/event.h
opal_event_external_basedir=opal/mca/event/external
opal_event_base_include="external/external.h"
# Add some stuff to CPPFLAGS so that the rest of the source
# tree can be built
CPPFLAGS="$CPPFLAGS $opal_event_external_CPPFLAGS"
LDFLAGS="$LDFLAGS $opal_event_external_LDFLAGS"
LIBS="$LIBS $opal_event_external_LIBS"
# These flags need to get passed to the wrapper compilers
# (this is unnecessary for the internal/embedded event)
# Finally, add some flags to the wrapper compiler if we're
# building with developer headers so that our headers can
# be found.
event_external_WRAPPER_EXTRA_CPPFLAGS="$opal_event_external_CPPFLAGS"
event_external_WRAPPER_EXTRA_LDFLAGS="$opal_event_external_LDFLAGS"
event_external_WRAPPER_EXTRA_LIBS="$opal_event_external_LIBS"
])
])dnl
# MCA_event_external_CONFIG([action-if-found], [action-if-not-found])
# --------------------------------------------------------------------
AC_DEFUN([MCA_opal_event_external_CONFIG],[
AC_CONFIG_FILES([opal/mca/event/external/Makefile])
OPAL_VAR_SCOPE_PUSH([opal_event_external_CPPFLAGS_save opal_event_external_CFLAGS_save opal_event_external_LDFLAGS_save opal_event_external_LIBS_save])
AC_ARG_WITH([external-libevent],
[AC_HELP_STRING([--with-external-libevent=DIR],
[Search for event libraries in DIR. Should only be used if an external copy of libevent is being used.])])
# Do we want this external component?
opal_event_external_want=no
AS_IF([test "$with_external_libevent" != ""], [opal_event_external_want=yes])
# If we still want external support, try it
AS_IF([test "$opal_event_external_want" = "yes"],
[OMPI_CHECK_WITHDIR([external-libevent], [$with_event_libdir],
[libevent.*])
AC_MSG_CHECKING([looking for external event in...])
AS_IF([test ! -z "$with_external_libevent" -a "$with_external_libevent" != "yes"],
[opal_event_libdir="$with_external_libevent"
AC_MSG_RESULT([$opal_event_libdir])],
[AC_MSG_RESULT([default search paths])])
opal_event_external_CPPFLAGS_save=$CPPFLAGS
opal_event_external_CFLAGS_save=$CFLAGS
opal_event_external_LDFLAGS_save=$LDFLAGS
opal_event_external_LIBS_save=$LIBS
OMPI_CHECK_PACKAGE([opal_event_external],
[event.h],
[event],
[event_config_new],
[],
[$opal_event_libdir],
[$opal_event_libdir],
[opal_event_external_support=yes],
[opal_event_external_support=no])
CPPFLAGS=$opal_event_external_CPPFLAGS_save
CFLAGS=$opal_event_external_CFLAGS_save
LDFLAGS=$opal_event_external_LDFLAGS_save
LIBS=$opal_event_external_LIBS_save
# check for pthread support - must do this after
# restoring LIBS as otherwise the results of
# this macro will be overwritten
OMPI_CHECK_FUNC_LIB([evthread_use_pthreads],
[event_pthreads],
[opal_event_external_has_threads=1],
[opal_event_external_has_threads=0])
])
# Done!
AS_IF([test "$opal_event_external_support" = "yes"],
[AC_DEFINE_UNQUOTED([EVENT_EXTERNAL_EVENT_VERSION],
[external],
[Version of event])
AC_DEFINE_UNQUOTED([OPAL_HAVE_EXTERNAL_EVENT_THREAD_SUPPORT],
[$opal_event_external_has_threads],
[Whether the external libevent has thread support])
$1],
[$2])
AC_SUBST(opal_event_external_CPPFLAGS)
AC_SUBST(opal_event_external_LDFLAGS)
AC_SUBST(opal_event_external_LIBS)
OPAL_VAR_SCOPE_POP
])dnl

64
opal/mca/event/external/event_external_component.c поставляемый Обычный файл
Просмотреть файл

@ -0,0 +1,64 @@
/*
* Copyright (c) 2011 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2013 Los Alamos National Security, LLC. All rights reserved.
*
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "opal_config.h"
#include "opal/constants.h"
#include "opal/mca/event/event.h"
/*
* Public string showing the sysinfo ompi_linux component version number
*/
const char *opal_event_external_component_version_string =
"OPAL event_external event MCA component version " OPAL_VERSION;
/*
* Local function
*/
static int event_external_open(void);
/*
* Instantiate the public struct with all of our public information
* and pointers to our public functions in it
*/
const opal_event_component_t mca_event_external_component = {
/* First, the mca_component_t struct containing meta information
about the component itself */
{
OPAL_EVENT_BASE_VERSION_2_0_0,
/* Component name and version */
"external",
OPAL_MAJOR_VERSION,
OPAL_MINOR_VERSION,
OPAL_RELEASE_VERSION,
/* Component open and close functions */
event_external_open,
NULL
},
{
/* The component is checkpoint ready */
MCA_BASE_METADATA_PARAM_CHECKPOINT
}
};
static int event_external_open(void)
{
/* Must have some code in this file, or the OS X linker may
eliminate the whole file */
return OPAL_SUCCESS;
}

30
opal/mca/event/external/event_external_module.c поставляемый Обычный файл
Просмотреть файл

@ -0,0 +1,30 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2010 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012-2013 Los Alamos National Security, LLC.
* All rights reserved.
*/
#include "opal_config.h"
#include "opal/constants.h"
#include "opal/util/output.h"
#include "opal/mca/event/base/base.h"
#include "external.h"
int opal_event_init(void)
{
if (opal_output_get_verbosity(opal_event_base_framework.framework_output) > 4) {
event_enable_debug_mode();
}
return OPAL_SUCCESS;
}
opal_event_t* opal_event_alloc(void)
{
opal_event_t *ev;
ev = (opal_event_t*)malloc(sizeof(opal_event_t));
return ev;
}

116
opal/mca/event/external/external.h поставляемый Обычный файл
Просмотреть файл

@ -0,0 +1,116 @@
/*
* Copyright (c) 2011-2012 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2013 Los Alamos National Security, LLC. All rights reserved.
*
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*
* When this component is used, this file is included in the rest of
* the OPAL/ORTE/OMPI code base via opal/mca/event/event.h. As such,
* this header represents the public interface to this static component.
*/
#ifndef MCA_OPAL_EVENT_EXTERNAL_H
#define MCA_OPAL_EVENT_EXTERNAL_H
#include "event.h"
#include "event2/event.h"
#include "event2/thread.h"
typedef event_callback_fn opal_event_cbfunc_t;
BEGIN_C_DECLS
typedef struct event_base opal_event_base_t;
typedef struct event opal_event_t;
OPAL_DECLSPEC extern opal_event_base_t *opal_event_base;
#define OPAL_EV_TIMEOUT EV_TIMEOUT
#define OPAL_EV_READ EV_READ
#define OPAL_EV_WRITE EV_WRITE
#define OPAL_EV_SIGNAL EV_SIGNAL
/* Persistent event: won't get removed automatically when activated. */
#define OPAL_EV_PERSIST EV_PERSIST
#define OPAL_EVLOOP_ONCE EVLOOP_ONCE /**< Block at most once. */
#define OPAL_EVLOOP_NONBLOCK EVLOOP_NONBLOCK /**< Do not block. */
/* Global function to create and release an event base */
#define opal_event_base_create() event_base_new()
#define opal_event_base_free(x) event_base_free(x)
OPAL_DECLSPEC int opal_event_init(void);
#define opal_event_reinit(b) event_reinit((b))
#define opal_event_base_init_common_timeout (b, t) event_base_init_common_timeout((b), (t))
#define opal_event_base_loopbreak(b) event_base_loopbreak(b)
#define opal_event_base_loopexit(b) event_base_loopexit(b, NULL)
/* Event priority APIs */
#define opal_event_base_priority_init(b, n) event_base_priority_init((b), (n))
#define opal_event_set_priority(x, n) event_priority_set((x), (n))
/* thread support APIs */
#if OPAL_HAVE_EXTERNAL_EVENT_THREAD_SUPPORT
#define opal_event_use_threads() evthread_use_pthreads()
#else
#define opal_event_use_threads()
#endif
/* Basic event APIs */
#define opal_event_enable_debug_mode() event_enable_debug_mode()
#define opal_event_set(b, x, fd, fg, cb, arg) event_assign((x), (b), (fd), (fg), (event_callback_fn) (cb), (arg))
#define opal_event_add(ev, tv) event_add((ev), (tv))
#define opal_event_del(ev) event_del((ev))
#define opal_event_active(x, y, z) event_active((x), (y), (z))
#define opal_event_new(b, fd, fg, cb, arg) event_new((b), (fd), (fg), (event_callback_fn) (cb), (arg))
OPAL_DECLSPEC opal_event_t* opal_event_alloc(void);
#define opal_event_free(x) event_free((x))
/* Timer APIs */
#define opal_event_evtimer_new(b, cb, arg) opal_event_new((b), -1, 0, (cb), (arg))
#define opal_event_evtimer_add(x, tv) opal_event_add((x), (tv))
#define opal_event_evtimer_set(b, x, cb, arg) event_assign((x), (b), -1, 0, (event_callback_fn) (cb), (arg))
#define opal_event_evtimer_del(x) opal_event_del((x))
#define opal_event_evtimer_pending(x, tv) event_pending((x), EV_TIMEOUT, (tv))
#define opal_event_evtimer_initialized(x) event_initialized((x))
/* Signal APIs */
#define opal_event_signal_add(x, tv) event_add((x), (tv))
#define opal_event_signal_set(b, x, fd, cb, arg) event_assign((x), (b), (fd), EV_SIGNAL|EV_PERSIST, (event_callback_fn) (cb), (arg))
#define opal_event_signal_del(x) event_del((x))
#define opal_event_signal_pending(x, tv) event_pending((x), EV_SIGNAL, (tv))
#define opal_event_signal_initalized(x) event_initialized((x))
#define opal_event_get_signal(x) event_get_signal((x))
#define opal_event_loop(b, fg) event_base_loop((b), (fg))
END_C_DECLS
#endif /* MCA_OPAL_EVENT_EXTERNAL_H */

Просмотреть файл

@ -39,6 +39,7 @@
#include "opal/runtime/opal.h"
#include "opal/runtime/opal_cr.h"
#include "opal/util/argv.h"
#include "opal/util/if.h"
#include "opal/util/os_path.h"
#include "opal/util/output.h"

Просмотреть файл

@ -12,6 +12,7 @@
#include "orte_config.h"
#include "opal/mca/base/base.h"
#include "opal/util/argv.h"
#include "orte/util/proc_info.h"

Просмотреть файл

@ -18,6 +18,7 @@
#include "opal/class/opal_list.h"
#include "opal/mca/hwloc/hwloc.h"
#include "opal/util/argv.h"
#include "orte/util/show_help.h"
#include "orte/runtime/orte_globals.h"

Просмотреть файл

@ -27,6 +27,7 @@
#endif
#include "opal/mca/mca.h"
#include "opal/util/argv.h"
#include "opal/util/output.h"
#include "opal/mca/base/base.h"

Просмотреть файл

@ -28,6 +28,7 @@
#endif /* HAVE_UNISTD_H */
#include <string.h>
#include "opal/util/argv.h"
#include "opal/util/if.h"
#include "opal/util/output.h"
#include "opal/mca/mca.h"

Просмотреть файл

@ -13,6 +13,8 @@
*/
#include "rmaps_lama.h"
#include "opal/util/argv.h"
#include "orte/mca/rmaps/base/rmaps_private.h"
#include "orte/mca/rmaps/base/base.h"

Просмотреть файл

@ -22,6 +22,7 @@
#endif /* HAVE_STRING_H */
#include "opal/mca/hwloc/base/base.h"
#include "opal/util/argv.h"
#include "orte/util/show_help.h"
#include "orte/mca/errmgr/errmgr.h"

Просмотреть файл

@ -22,6 +22,7 @@
#include "opal/mca/hwloc/base/base.h"
#include "opal/dss/dss.h"
#include "opal/util/argv.h"
#include "opal/util/output.h"
#include "orte/util/show_help.h"