1
1

Bring the error manager over to the main branch so people can start to use it in their code. Please see mca/errmgr/errmgr.h for the documentation on this function - very little implemented at the moment. Only function so far is to output the error message, file, and line via the ompi_output function.

Note: in bringing this across, I have obeyed the mca-prefix-rule in defining functions and variables. However, I left the name of the component call as "orte_errmgr.xxx" so that any use of the code will directly "merge" with the new RTE branch without changes.

This commit was SVN r4099.
Этот коммит содержится в:
Ralph Castain 2005-01-21 17:49:14 +00:00
родитель 76f2125c98
Коммит cd00fed56b
13 изменённых файлов: 527 добавлений и 1 удалений

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

@ -65,7 +65,7 @@ fi
# The list of MCA types (it's fixed)
AC_MSG_CHECKING([for MCA types])
found_types="common allocator coll gpr io iof llm mpool ns one oob op pcm pcmclient pml ptl soh svc topo"
found_types="common allocator coll errmgr gpr io iof llm mpool ns one oob op pcm pcmclient pml ptl soh svc topo"
AC_MSG_RESULT([$found_types])
# Get the list of all the non-configure MCA components that were found by
@ -339,6 +339,11 @@ AC_SUBST(MCA_pcmclient_STATIC_SUBDIRS)
AC_SUBST(MCA_pcmclient_DSO_SUBDIRS)
AC_SUBST(MCA_pcmclient_STATIC_LTLIBS)
AC_SUBST(MCA_errmgr_ALL_SUBDIRS)
AC_SUBST(MCA_errmgr_STATIC_SUBDIRS)
AC_SUBST(MCA_errmgr_DSO_SUBDIRS)
AC_SUBST(MCA_errmgr_STATIC_LTLIBS)
AC_SUBST(MCA_gpr_ALL_SUBDIRS)
AC_SUBST(MCA_gpr_STATIC_SUBDIRS)
AC_SUBST(MCA_gpr_DSO_SUBDIRS)

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

@ -1414,6 +1414,8 @@ AC_CONFIG_FILES([
src/mca/allocator/base/Makefile
src/mca/coll/Makefile
src/mca/coll/base/Makefile
src/mca/errmgr/Makefile
src/mca/errmgr/base/Makefile
src/mca/gpr/Makefile
src/mca/gpr/base/Makefile
src/mca/io/Makefile
@ -1445,6 +1447,7 @@ AC_CONFIG_FILES([
src/dynamic-mca/Makefile
src/dynamic-mca/allocator/Makefile
src/dynamic-mca/coll/Makefile
src/dynamic-mca/errmgr/Makefile
src/dynamic-mca/gpr/Makefile
src/dynamic-mca/io/Makefile
src/dynamic-mca/iof/Makefile

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

@ -18,6 +18,7 @@ SUBDIRS = \
allocator \
coll \
common \
errmgr \
gpr \
io \
iof \

24
src/dynamic-mca/errmgr/Makefile.am Обычный файл
Просмотреть файл

@ -0,0 +1,24 @@
#
# 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.
# Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
# University of Stuttgart. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
include $(top_srcdir)/config/Makefile.options
SUBDIRS = $(MCA_errmgr_DSO_SUBDIRS)
DISTCLEANFILES = $(SUBDIRS)
# Every directory under here is a sym link to something in the main
# src/mca tree. Hence, we don't want to distribute anything under
# here.
DIST_SUBDIRS =

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

@ -19,6 +19,7 @@ SUBDIRS = \
base \
coll \
common \
errmgr \
gpr \
io \
iof \

32
src/mca/errmgr/Makefile.am Обычный файл
Просмотреть файл

@ -0,0 +1,32 @@
#
# 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.
# Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
# University of Stuttgart. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
include $(top_srcdir)/config/Makefile.options
SUBDIRS = base $(MCA_errmgr_STATIC_SUBDIRS)
DIST_SUBDIRS = base $(MCA_errmgr_ALL_SUBDIRS)
# Source code files
headers = \
errmgr.h
# Conditionally install the header files
if WANT_INSTALL_HEADERS
ompidir = $(includedir)/openmpi/mca/errmgr
ompi_HEADERS = $(headers)
else
ompidir = $(includedir)
endif

45
src/mca/errmgr/base/Makefile.am Обычный файл
Просмотреть файл

@ -0,0 +1,45 @@
#
# 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.
# Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
# University of Stuttgart. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
include $(top_srcdir)/config/Makefile.options
noinst_LTLIBRARIES = libmca_errmgr_base.la
# For VPATH builds, have to specify where static-modules.h will be found
AM_CPPFLAGS = -I$(top_builddir)/src
# Source code files
headers = \
base.h
# Library
libmca_errmgr_base_la_SOURCES = \
$(headers) \
errmgr_base_close.c \
errmgr_base_select.c \
errmgr_base_open.c \
errmgr_base_log.c
# Conditionally install the header files
if WANT_INSTALL_HEADERS
ompidir = $(includedir)/openmpi/mca/errmgr/base
ompi_HEADERS = $(headers)
else
ompidir = $(includedir)
endif

72
src/mca/errmgr/base/base.h Обычный файл
Просмотреть файл

@ -0,0 +1,72 @@
/*
* 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.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
/** @file:
*/
#ifndef MCA_ERRMGR_BASE_H
#define MCA_ERRMGR_BASE_H
/*
* includes
*/
#include "ompi_config.h"
#include "include/constants.h"
#include "class/ompi_list.h"
#include "mca/mca.h"
#include "mca/errmgr/errmgr.h"
/*
* Global functions for MCA overall collective open and close
*/
#if defined(c_plusplus) || defined(__cplusplus)
extern "C" {
#endif
/*
* Internal definitions
*/
/*
* function definitions
*/
OMPI_DECLSPEC int mca_errmgr_base_open(void);
OMPI_DECLSPEC int mca_errmgr_base_select(bool *allow_multi_user_threads,
bool *have_hidden_threads);
OMPI_DECLSPEC int mca_errmgr_base_close(void);
/*
* Base functions that are common to all implementations - can be overridden
*/
OMPI_DECLSPEC void mca_errmgr_base_log(char *msg, char *filename, int line);
/*
* globals that might be needed
*/
OMPI_DECLSPEC extern int mca_errmgr_base_output;
OMPI_DECLSPEC extern bool mca_errmgr_base_selected;
OMPI_DECLSPEC extern ompi_list_t mca_errmgr_base_components_available;
OMPI_DECLSPEC extern mca_errmgr_base_component_t mca_errmgr_base_selected_component;
/*
* external API functions will be documented in the mca/errmgr/errmgr.h file
*/
#if defined(c_plusplus) || defined(__cplusplus)
}
#endif
#endif

42
src/mca/errmgr/base/errmgr_base_close.c Обычный файл
Просмотреть файл

@ -0,0 +1,42 @@
/*
* 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.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "ompi_config.h"
#include <stdio.h>
#include "include/constants.h"
#include "mca/mca.h"
#include "mca/base/base.h"
#include "mca/errmgr/base/base.h"
int mca_errmgr_base_close(void)
{
/* If we have a selected component and module, then finalize it */
if (mca_errmgr_base_selected) {
mca_errmgr_base_selected_component.errmgr_finalize();
}
/* Close all remaining available components (may be one if this is a
OMPI RTE program, or [possibly] multiple if this is mca_info) */
mca_base_components_close(mca_errmgr_base_output,
&mca_errmgr_base_components_available, NULL);
/* All done */
return OMPI_SUCCESS;
}

29
src/mca/errmgr/base/errmgr_base_log.c Обычный файл
Просмотреть файл

@ -0,0 +1,29 @@
/*
* 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.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "ompi_config.h"
#include "util/output.h"
#include "runtime/runtime.h"
#include "mca/ns/ns.h"
#include "mca/errmgr/base/base.h"
void mca_errmgr_base_log(char *msg, char *filename, int line)
{
ompi_output(0, "[%d,%d,%d] ORTE_ERROR_LOG: %s in file %s at line %d",
OMPI_NAME_ARGS(*ompi_rte_get_self()), msg, filename, line);
}

75
src/mca/errmgr/base/errmgr_base_open.c Обычный файл
Просмотреть файл

@ -0,0 +1,75 @@
/*
* 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.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "ompi_config.h"
#include "include/constants.h"
#include "mca/mca.h"
#include "mca/base/base.h"
#include "mca/base/mca_base_param.h"
#include "util/output.h"
#include "mca/errmgr/base/base.h"
/*
* The following file was created by configure. It contains extern
* statements and the definition of an array of pointers to each
* component's public mca_base_component_t struct.
*/
#include "mca/errmgr/base/static-components.h"
/*
* globals
*/
/*
* Global variables
*/
int mca_errmgr_base_output = -1;
mca_errmgr_base_module_t orte_errmgr = {
mca_errmgr_base_log
};
bool mca_errmgr_base_selected = false;
ompi_list_t mca_errmgr_base_components_available;
mca_errmgr_base_component_t mca_errmgr_base_selected_component;
/**
* Function for finding and opening either all MCA components, or the one
* that was specifically requested via a MCA parameter.
*/
int mca_errmgr_base_open(void)
{
/* Open up all available components */
if (OMPI_SUCCESS !=
mca_base_components_open("mca_errmgr", 0, mca_errmgr_base_static_components,
&mca_errmgr_base_components_available)) {
return OMPI_ERROR;
}
/* setup output for debug messages */
if (!ompi_output_init) { /* can't open output */
return OMPI_ERROR;
}
mca_errmgr_base_output = ompi_output_open(NULL);
/* All done */
return OMPI_SUCCESS;
}

101
src/mca/errmgr/base/errmgr_base_select.c Обычный файл
Просмотреть файл

@ -0,0 +1,101 @@
/*
* 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.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "ompi_config.h"
#include "mca/mca.h"
#include "mca/base/base.h"
#include "mca/errmgr/base/base.h"
/**
* Function for selecting one component from all those that are
* available.
*/
int mca_errmgr_base_select(bool *allow_multi_user_threads,
bool *have_hidden_threads)
{
ompi_list_item_t *item;
mca_base_component_list_item_t *cli;
mca_errmgr_base_component_t *component, *best_component = NULL;
mca_errmgr_base_module_t *module, *best_module = NULL;
bool multi, hidden;
int priority, best_priority = -1;
/* Iterate through all the available components */
for (item = ompi_list_get_first(&mca_errmgr_base_components_available);
item != ompi_list_get_end(&mca_errmgr_base_components_available);
item = ompi_list_get_next(item)) {
cli = (mca_base_component_list_item_t *) item;
component = (mca_errmgr_base_component_t *) cli->cli_component;
/* Call the component's init function and see if it wants to be
selected */
module = component->errmgr_init(&multi, &hidden, &priority);
/* If we got a non-NULL module back, then the component wants to
be selected. So save its multi/hidden values and save the
module with the highest priority */
if (NULL != module) {
/* If this is the best one, save it */
if (priority > best_priority) {
/* If there was a previous best one, finalize */
if (NULL != best_component) {
best_component->errmgr_finalize();
}
/* Save the new best one */
best_module = module;
best_component = component;
*allow_multi_user_threads = multi;
*have_hidden_threads = hidden;
/* update the best priority */
best_priority = priority;
}
/* If it's not the best one, finalize it */
else {
component->errmgr_finalize();
}
}
}
/* If we didn't find one to select, that's okay - stick with default */
if (NULL == best_component) {
return OMPI_SUCCESS;
}
/* We have happiness -- save the component and module for later
usage */
orte_errmgr = *best_module;
mca_errmgr_base_selected_component = *best_component;
mca_errmgr_base_selected = true;
/* all done */
return OMPI_SUCCESS;
}

96
src/mca/errmgr/errmgr.h Обычный файл
Просмотреть файл

@ -0,0 +1,96 @@
/*
* 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.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
/** @file:
*
* The Open RTE Error Manager
*
*/
#ifndef OMPI_MCA_ERRMGR_H
#define OMPI_MCA_ERRMGR_H
/*
* includes
*/
#include "ompi_config.h"
#include "include/constants.h"
/*
* Component functions - all MUST be provided!
*/
/**
* Log an error
* Log an error that occurred in the runtime environment.
*
* @code
* ompi_errmgr.log("this is an error", __FILE__, __LINE__);
* @endcode
*/
typedef void (*mca_errmgr_base_module_log_fn_t)(char *msg, char *filename, int line);
/*
* Ver 1.0.0
*/
struct mca_errmgr_base_module_1_0_0_t {
mca_errmgr_base_module_log_fn_t log;
};
typedef struct mca_errmgr_base_module_1_0_0_t mca_errmgr_base_module_1_0_0_t;
typedef mca_errmgr_base_module_1_0_0_t mca_errmgr_base_module_t;
/*
* ERRMGR Component
*/
typedef mca_errmgr_base_module_t* (*mca_errmgr_base_component_init_fn_t)(
bool *allow_multi_user_threads,
bool *have_hidden_threads,
int *priority);
typedef int (*mca_errmgr_base_component_finalize_fn_t)(void);
/*
* the standard component data structure
*/
struct mca_errmgr_base_component_1_0_0_t {
mca_base_component_t errmgr_version;
mca_base_component_data_1_0_0_t errmgr_data;
mca_errmgr_base_component_init_fn_t errmgr_init;
mca_errmgr_base_component_finalize_fn_t errmgr_finalize;
};
typedef struct mca_errmgr_base_component_1_0_0_t mca_errmgr_base_component_1_0_0_t;
typedef mca_errmgr_base_component_1_0_0_t mca_errmgr_base_component_t;
/*
* Macro for use in components that are of type errmgr v1.0.0
*/
#define OMPI_MCA_ERRMGR_BASE_VERSION_1_0_0 \
/* mca v1.0 is chained to MCA v1.0 */ \
MCA_BASE_VERSION_1_0_0, \
/* errmgr v1.0 */ \
"errmgr", 1, 0, 0
/* Global structure for accessing error manager functions
*/
OMPI_DECLSPEC extern mca_errmgr_base_module_t orte_errmgr; /* holds selected module's function pointers */
#endif