1
1

Per the meeting on moving the BTLs to OPAL, move the ORTE database "db" framework to OPAL so the relocated BTLs can access it. Because the data is indexed by process, this requires that we define a new "opal_identifier_t" that corresponds to the orte_process_name_t struct. In order to support multiple run-times, this is defined in opal/mca/db/db_types.h as a uint64_t without identifying the meaning of any part of that data.

A few changes were required to support this move:

1. the PMI component used to identify rte-related data (e.g., host name, bind level) and package them as a unit to reduce the number of PMI keys. This code was moved up to the ORTE layer as the OPAL layer has no understanding of these concepts. In addition, the component locally stored data based on process jobid/vpid - this could no longer be supported (see below for the solution).

2. the hash component was updated to use the new opal_identifier_t instead of orte_process_name_t as its index for storing data in the hash tables. Previously, we did a hash on the vpid and stored the data in a 32-bit hash table. In the revised system, we don't see a separate "vpid" field - we only have a 64-bit opaque value. The orte_process_name_t hash turned out to do nothing useful, so we now store the data in a 64-bit hash table. Preliminary tests didn't show any identifiable change in behavior or performance, but we'll have to see if a move back to the 32-bit table is required at some later time.

3. the db framework was a "select one" system. However, since the PMI component could no longer use its internal storage system, the framework has now been changed to a "select many" mode of operation. This allows the hash component to handle all internal storage, while the PMI component only handles pushing/pulling things from the PMI system. This was something we had planned for some time - when fetching data, we first check internal storage to see if we already have it, and then automatically go to the global system to look for it if we don't. Accordingly, the framework was provided with a custom query function used during "select" that lets you seperately specify the "store" and "fetch" ordering.

4. the ORTE grpcomm and ess/pmi components, and the nidmap code,  were updated to work with the new db framework and to specify internal/global storage options.

No changes were made to the MPI layer, except for modifying the ORTE component of the OMPI/rte framework to support the new db framework.

This commit was SVN r28112.
Этот коммит содержится в:
Ralph Castain 2013-02-26 17:50:04 +00:00
родитель 7136dbb5b3
Коммит bd9265c560
78 изменённых файлов: 1957 добавлений и 2331 удалений

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

@ -11,7 +11,7 @@
# Copyright (c) 2004-2005 The Regents of the University of California.
# All rights reserved.
# Copyright (c) 2009-2011 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2011 Los Alamos National Security, LLC. All rights
# Copyright (c) 2011-2013 Los Alamos National Security, LLC. All rights
# reserved.
# $COPYRIGHT$
#
@ -20,9 +20,9 @@
# $HEADER$
#
# ORTE_CHECK_PMI(prefix, [action-if-found], [action-if-not-found])
# OPAL_CHECK_PMI(prefix, [action-if-found], [action-if-not-found])
# --------------------------------------------------------
AC_DEFUN([ORTE_CHECK_PMI],[
AC_DEFUN([OPAL_CHECK_PMI],[
AC_ARG_WITH([pmi],
[AC_HELP_STRING([--with-pmi],
[Build PMI support (default: no)])],
@ -32,23 +32,23 @@ AC_DEFUN([ORTE_CHECK_PMI],[
[Include Cray PMI2 extensions (default: no)])],
[], with_cray_pmi2_ext=no)
orte_enable_pmi=0
orte_use_cray_pmi2_ext=0
opal_enable_pmi=0
opal_use_cray_pmi2_ext=0
# save flags
orte_check_pmi_$1_save_CPPFLAGS="$CPPFLAGS"
orte_check_pmi_$1_save_LDFLAGS="$LDFLAGS"
orte_check_pmi_$1_save_LIBS="$LIBS"
opal_check_pmi_$1_save_CPPFLAGS="$CPPFLAGS"
opal_check_pmi_$1_save_LDFLAGS="$LDFLAGS"
opal_check_pmi_$1_save_LIBS="$LIBS"
# set defaults
orte_check_pmi_$1_LDFLAGS=
orte_check_pmi_$1_CPPFLAGS=
orte_check_pmi_$1_LIBS=
opal_check_pmi_$1_LDFLAGS=
opal_check_pmi_$1_CPPFLAGS=
opal_check_pmi_$1_LIBS=
AC_MSG_CHECKING([if user requested PMI support])
AS_IF([test "$with_pmi" = "no"],
[AC_MSG_RESULT([no])
orte_use_cray_pmi2_ext=0
opal_use_cray_pmi2_ext=0
$3],
[AC_MSG_RESULT([yes])
AC_MSG_CHECKING([if PMI support installed])
@ -57,14 +57,14 @@ AC_DEFUN([ORTE_CHECK_PMI],[
# work with slurm :-(
AS_IF([test ! -z "$with_pmi" -a "$with_pmi" != "yes"],
[AS_IF([test -d "$with_pmi/lib64"],
[orte_check_pmi_$1_LDFLAGS="-L$with_pmi/lib64"
orte_check_pmi_$1_LIBS="-lpmi -Wl,-rpath=$with_pmi/lib64"],
[orte_check_pmi_$1_LDFLAGS="-L$with_pmi/lib"
orte_check_pmi_$1_LIBS="-lpmi -Wl,-rpath=$with_pmi/lib"])
[opal_check_pmi_$1_LDFLAGS="-L$with_pmi/lib64"
opal_check_pmi_$1_LIBS="-lpmi -Wl,-rpath=$with_pmi/lib64"],
[opal_check_pmi_$1_LDFLAGS="-L$with_pmi/lib"
opal_check_pmi_$1_LIBS="-lpmi -Wl,-rpath=$with_pmi/lib"])
AS_IF([test -f "$with_pmi/include/pmi.h"],
[orte_check_pmi_$1_CPPFLAGS="-I$with_pmi/include"],
[opal_check_pmi_$1_CPPFLAGS="-I$with_pmi/include"],
[AS_IF([test -f "$with_pmi/include/slurm/pmi.h"],
[orte_check_pmi_$1_CPPFLAGS="-I$with_pmi/include/slurm"],
[opal_check_pmi_$1_CPPFLAGS="-I$with_pmi/include/slurm"],
[AC_MSG_RESULT([not found])
AC_MSG_WARN([PMI support requested (via --with-pmi) but pmi.h])
AC_MSG_WARN([not found under locations:])
@ -74,21 +74,21 @@ AC_DEFUN([ORTE_CHECK_PMI],[
AC_MSG_ERROR([Aborting])
$3])])],
[AS_IF([test -f "/usr/include/slurm/pmi.h"],
[orte_check_pmi_$1_CPPFLAGS="-I/usr/include/slurm"])])
[opal_check_pmi_$1_CPPFLAGS="-I/usr/include/slurm"])])
LDFLAGS="$LDFLAGS $orte_check_pmi_$1_LDFLAGS"
CPPFLAGS="$CPPFLAGS $orte_check_pmi_$1_CPPFLAGS"
LIBS="$LIBS $orte_check_pmi_$1_LIBS"
orte_have_pmi_support=no
LDFLAGS="$LDFLAGS $opal_check_pmi_$1_LDFLAGS"
CPPFLAGS="$CPPFLAGS $opal_check_pmi_$1_CPPFLAGS"
LIBS="$LIBS $opal_check_pmi_$1_LIBS"
opal_have_pmi_support=no
AC_CHECK_HEADERS([pmi.h],
[AC_CHECK_LIB([pmi], [PMI_Init],
[orte_have_pmi_support=yes])])
[opal_have_pmi_support=yes])])
AS_IF([test "$orte_have_pmi_support" = "yes"],
AS_IF([test "$opal_have_pmi_support" = "yes"],
[AC_MSG_RESULT([yes])
orte_enable_pmi=1
$1_LDFLAGS="$orte_check_pmi_$1_LDFLAGS"
$1_CPPFLAGS="$orte_check_pmi_$1_CPPFLAGS"
opal_enable_pmi=1
$1_LDFLAGS="$opal_check_pmi_$1_LDFLAGS"
$1_CPPFLAGS="$opal_check_pmi_$1_CPPFLAGS"
$1_LIBS="-lpmi"
$2],
[AC_MSG_RESULT([no])
@ -99,31 +99,31 @@ AC_DEFUN([ORTE_CHECK_PMI],[
AC_MSG_CHECKING([if user requested Cray PMI2 extensions])
AS_IF([test "$with_cray_pmi2_ext" = "no"],
[AC_MSG_RESULT([no])
orte_use_pmi2_ext=0],
opal_use_pmi2_ext=0],
[AC_MSG_RESULT([yes])
# check to see if pmi2.h header is present. if it is, then we
# will use some of the functions in it.
AC_MSG_CHECKING([if PMI2 extensions installed])
AS_IF([test -f "$with_pmi/include/pmi2.h"],
[orte_use_pmi2_ext=1
[opal_use_pmi2_ext=1
AC_MSG_RESULT(yes)],
[AC_MSG_RESULT([no])
AC_MSG_WARN([PMI2 extensions requested (via --with-cray-pmi2-ext) but not found.])
AC_MSG_ERROR([Aborting.])
orte_use_pmi2_ext=0
orte_enable_pmi=0
opal_use_pmi2_ext=0
opal_enable_pmi=0
$3])])])
# restore flags - have to add CPPFLAGS so base functions can find pmi.h
CPPFLAGS="$orte_check_pmi_$1_save_CPPFLAGS $orte_check_pmi_$1_CPPFLAGS"
LDFLAGS="$orte_check_pmi_$1_save_LDFLAGS"
LIBS="$orte_check_pmi_$1_save_LIBS"
CPPFLAGS="$opal_check_pmi_$1_save_CPPFLAGS $opal_check_pmi_$1_CPPFLAGS"
LDFLAGS="$opal_check_pmi_$1_save_LDFLAGS"
LIBS="$opal_check_pmi_$1_save_LIBS"
AC_DEFINE_UNQUOTED([WANT_PMI_SUPPORT],
[$orte_enable_pmi],
[$opal_enable_pmi],
[Whether we want PMI support])
AC_DEFINE_UNQUOTED([WANT_CRAY_PMI2_EXT],
[$orte_use_pmi2_ext],
[$opal_use_pmi2_ext],
[Whether we want to use Cray PMI2 extensions])
AM_CONDITIONAL(WANT_PMI_SUPPORT, [test "$orte_enable_pmi" = 1])
AM_CONDITIONAL(WANT_PMI_SUPPORT, [test "$opal_enable_pmi" = 1])
])

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

@ -24,7 +24,7 @@ AC_DEFUN([ORTE_CHECK_ALPS],[
if test -z "$orte_check_alps_happy"; then
# require that we check for pmi support request first so
# we can get the static library ordering correct
AC_REQUIRE([ORTE_CHECK_PMI])
AC_REQUIRE([OPAL_CHECK_PMI])
AC_ARG_WITH([alps],
[AC_HELP_STRING([--with-alps(=DIR|yes|no)],

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

@ -12,7 +12,7 @@
AC_DEFUN([MCA_ompi_pubsub_pmi_CONFIG], [
AC_CONFIG_FILES([ompi/mca/pubsub/pmi/Makefile])
ORTE_CHECK_PMI([pubsub_pmi], [pubsub_pmi_good=1], [pubsub_pmi_good=0])
OPAL_CHECK_PMI([pubsub_pmi], [pubsub_pmi_good=1], [pubsub_pmi_good=0])
# Evaluate succeed / fail
AS_IF([test "$pubsub_pmi_good" = 1],

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

@ -22,7 +22,6 @@
#include "ompi/info/info.h"
#include "orte/types.h"
#include "orte/mca/db/db.h"
#include "orte/mca/errmgr/errmgr.h"
#include "orte/mca/grpcomm/grpcomm.h"
#include "orte/mca/rml/base/rml_contact.h"
@ -79,11 +78,19 @@ OMPI_DECLSPEC void ompi_rte_abort(int error_code, char *fmt, ...);
OMPI_DECLSPEC void ompi_rte_wait_for_debugger(void);
/* Database operations */
#define ompi_rte_db_store(a, b, c, d) orte_db.store(a, b, c, d)
#define ompi_rte_db_fetch(a, b, c, d) orte_db.fetch(a, b, c, d)
#define ompi_rte_db_fetch_pointer(a, b, c, d) orte_db.fetch_pointer(a, b, c, d)
#define ompi_rte_db_fetch_multiple(a, b, c) orte_db.fetch_multiple(a, b, c)
#define ompi_rte_db_remove(a, b) orte_db.remove(a, b)
OMPI_DECLSPEC int ompi_rte_db_store(const ompi_process_name_t *nm, const char* key,
const void *data, opal_data_type_t type);
OMPI_DECLSPEC int ompi_rte_db_fetch(const ompi_process_name_t *nm,
const char *key,
void **data, opal_data_type_t type);
OMPI_DECLSPEC int ompi_rte_db_fetch_pointer(const ompi_process_name_t *nm,
const char *key,
void **data, opal_data_type_t type);
OMPI_DECLSPEC int ompi_rte_db_fetch_multiple(const ompi_process_name_t *nm,
const char *key,
opal_list_t *kvs);
OMPI_DECLSPEC int ompi_rte_db_remove(const ompi_process_name_t *nm,
const char *key);
#define OMPI_DB_HOSTNAME ORTE_DB_HOSTNAME
#define OMPI_DB_LOCALITY ORTE_DB_LOCALITY

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

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012 Los Alamos National Security, LLC.
* Copyright (c) 2012-2013 Los Alamos National Security, LLC.
* All rights reserved.
*/
#include "ompi_config.h"
@ -12,6 +12,7 @@
#include "opal/dss/dss.h"
#include "opal/util/argv.h"
#include "opal/util/opal_getcwd.h"
#include "opal/mca/db/db.h"
#include "orte/mca/errmgr/errmgr.h"
#include "orte/mca/ess/ess.h"
@ -139,3 +140,52 @@ void ompi_rte_wait_for_debugger(void)
}
}
}
int ompi_rte_db_store(const orte_process_name_t *nm, const char* key,
const void *data, opal_data_type_t type)
{
opal_identifier_t *id;
id = (opal_identifier_t*)nm;
return opal_db.store((*id), OPAL_DB_GLOBAL, key, data, type);
}
int ompi_rte_db_fetch(const orte_process_name_t *nm,
const char *key,
void **data, opal_data_type_t type)
{
opal_identifier_t *id;
id = (opal_identifier_t*)nm;
return opal_db.fetch((*id), key, data, type);
}
int ompi_rte_db_fetch_pointer(const orte_process_name_t *nm,
const char *key,
void **data, opal_data_type_t type)
{
opal_identifier_t *id;
id = (opal_identifier_t*)nm;
return opal_db.fetch_pointer((*id), key, data, type);
}
int ompi_rte_db_fetch_multiple(const orte_process_name_t *nm,
const char *key,
opal_list_t *kvs)
{
opal_identifier_t *id;
id = (opal_identifier_t*)nm;
return opal_db.fetch_multiple((*id), key, kvs);
}
int ompi_rte_db_remove(const orte_process_name_t *nm,
const char *key)
{
opal_identifier_t *id;
id = (opal_identifier_t*)nm;
return opal_db.remove((*id), key);
}

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

@ -29,7 +29,7 @@ AC_DEFUN([MCA_ompi_rte_pmi_POST_CONFIG],[
AC_DEFUN([MCA_ompi_rte_pmi_CONFIG], [
AC_CONFIG_FILES([ompi/mca/rte/pmi/Makefile])
ORTE_CHECK_PMI([rte_pmi], [rte_pmi_good=1], [rte_pmi_good=0])
OPAL_CHECK_PMI([rte_pmi], [rte_pmi_good=1], [rte_pmi_good=0])
# Evaluate succeed / fail
AS_IF([test "$rte_pmi_good" = 1],

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

@ -71,7 +71,10 @@ enum {
OPAL_ERR_NETWORK_NOT_PARSEABLE = (OPAL_ERR_BASE - 42),
OPAL_ERR_SILENT = (OPAL_ERR_BASE - 43),
OPAL_ERR_NOT_INITIALIZED = (OPAL_ERR_BASE - 44),
OPAL_ERR_NOT_BOUND = (OPAL_ERR_BASE - 45)
OPAL_ERR_NOT_BOUND = (OPAL_ERR_BASE - 45),
OPAL_ERR_TAKE_NEXT_OPTION = (OPAL_ERR_BASE - 46),
OPAL_ERR_PROC_ENTRY_NOT_FOUND = (OPAL_ERR_BASE - 47),
OPAL_ERR_DATA_VALUE_NOT_FOUND = (OPAL_ERR_BASE - 48)
};
#define OPAL_ERR_MAX (OPAL_ERR_BASE - 100)

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

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

@ -1,6 +1,8 @@
#
# Copyright (c) 2011 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2012 Sandia National Laboratories. All rights reserved.
# Copyright (c) 2013 Los Alamos National Security, LLC. All rights
# reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
@ -24,7 +26,7 @@ AM_CPPFLAGS = $(common_pmi_CPPFLAGS)
# control whether building an installed library or a convenience
# (noinst) library
if MCA_BUILD_orte_common_pmi_DSO
if MCA_BUILD_opal_common_pmi_DSO
component_noinst =
component_install = libmca_common_pmi.la
else

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

@ -12,9 +12,9 @@
* $HEADER$
*/
#include "orte_config.h"
#include "orte/constants.h"
#include "orte/types.h"
#include "opal_config.h"
#include "opal/constants.h"
#include "opal/types.h"
#include <string.h>
#include <pmi.h>
@ -79,7 +79,7 @@ void mca_common_pmi_finalize (void) {
}
/* useful util */
char* orte_errmgr_base_pmi_error(int pmi_err)
char* opal_errmgr_base_pmi_error(int pmi_err)
{
char * err_msg;

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

@ -12,8 +12,8 @@
* $HEADER$
*/
#if !defined(ORTE_MCA_COMMON_PMI)
#define ORTE_MCA_COMMON_PMI
#if !defined(OPAL_MCA_COMMON_PMI)
#define OPAL_MCA_COMMON_PMI
/**
* mca_common_pmi_init:
@ -33,13 +33,12 @@ bool mca_common_pmi_init (void);
*/
void mca_common_pmi_finalize (void);
#define ORTE_PMI_ERROR(pmi_err, pmi_func) \
#define OPAL_PMI_ERROR(pmi_err, pmi_func) \
do { \
opal_output(0, "%s[%s:%d:%s] %s: %s\n", \
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), \
opal_output(0, "[%s:%d:%s] %s: %s\n", \
__FILE__, __LINE__, __func__, \
pmi_func, orte_errmgr_base_pmi_error(pmi_err)); \
pmi_func, opal_errmgr_base_pmi_error(pmi_err)); \
} while(0);
OPAL_DECLSPEC char* orte_errmgr_base_pmi_error(int pmi_err);
OPAL_DECLSPEC char* opal_errmgr_base_pmi_error(int pmi_err);
#endif

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

@ -1,7 +1,7 @@
# -*- shell-script -*-
#
# Copyright (c) 2011 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2011-2012 Los Alamos National Security, LLC.
# Copyright (c) 2011-2013 Los Alamos National Security, LLC.
# All rights reserved.
# $COPYRIGHT$
#
@ -12,13 +12,13 @@
# MCA_common_pmi_CONFIG([action-if-found], [action-if-not-found])
# -----------------------------------------------------------
AC_DEFUN([MCA_orte_common_pmi_CONFIG], [
AC_CONFIG_FILES([orte/mca/common/pmi/Makefile])
AC_DEFUN([MCA_opal_common_pmi_CONFIG], [
AC_CONFIG_FILES([opal/mca/common/pmi/Makefile])
ORTE_CHECK_PMI([common_pmi], [common_pmi_good=1], [common_pmi_good=0])
OPAL_CHECK_PMI([common_pmi], [common_pmi_good=1], [common_pmi_good=0])
# Evaluate succeed / fail
AS_IF([test "$common_pmi_good" = 1 -a "$orte_without_full_support" = 0],
AS_IF([test "$common_pmi_good" = 1],
[$1],
[$2])

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

@ -22,8 +22,8 @@ libmca_db_la_SOURCES += $(headers)
# Conditionally install the header files
if WANT_INSTALL_HEADERS
ortedir = $(includedir)/openmpi/$(subdir)
nobase_orte_HEADERS = $(headers)
opaldir = $(includedir)/openmpi/$(subdir)
nobase_opal_HEADERS = $(headers)
endif
include base/Makefile.am

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

@ -1,6 +1,6 @@
#
# Copyright (c) 2010 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2012 Los Alamos National Security, Inc. All rights reserved.
# Copyright (c) 2012-2013 Los Alamos National Security, Inc. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow

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

@ -1,6 +1,6 @@
/*
* Copyright (c) 2010 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2012 Los Alamos National Security, Inc. All rights reserved.
* Copyright (c) 2012-2013 Los Alamos National Security, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -13,65 +13,69 @@
#ifndef MCA_DB_BASE_H
#define MCA_DB_BASE_H
#include "orte_config.h"
#include "orte/types.h"
#include "opal_config.h"
#include "opal/types.h"
#include "opal/mca/mca.h"
#include "opal/class/opal_list.h"
#include "opal/dss/dss.h"
#include "orte/mca/db/db.h"
#include "opal/mca/db/db.h"
BEGIN_C_DECLS
/**
* Open the db framework
*/
ORTE_DECLSPEC int orte_db_base_open(void);
OPAL_DECLSPEC int opal_db_base_open(void);
/**
* Select a db module
*/
ORTE_DECLSPEC int orte_db_base_select(void);
OPAL_DECLSPEC int opal_db_base_select(void);
/**
* Close the db framework
*/
ORTE_DECLSPEC int orte_db_base_close(void);
OPAL_DECLSPEC int opal_db_base_close(void);
typedef struct {
opal_list_item_t super;
int pri;
orte_db_base_module_t *module;
mca_base_component_t *component;
} orte_db_active_module_t;
OBJ_CLASS_DECLARATION(orte_db_active_module_t);
opal_db_base_module_t *module;
opal_db_base_component_t *component;
} opal_db_active_module_t;
OBJ_CLASS_DECLARATION(opal_db_active_module_t);
typedef struct {
int output;
opal_list_t available_components;
opal_list_t active_modules;
} orte_db_base_t;
ORTE_DECLSPEC extern orte_db_base_t orte_db_base;
opal_list_t store_order;
opal_list_t fetch_order;
} opal_db_base_t;
ORTE_DECLSPEC int orte_db_base_store(const orte_process_name_t *proc,
OPAL_DECLSPEC extern opal_db_base_t opal_db_base;
OPAL_DECLSPEC int opal_db_base_store(opal_identifier_t proc,
opal_db_locality_t locality,
const char *key, const void *object,
opal_data_type_t type);
ORTE_DECLSPEC int orte_db_base_store_pointer(const orte_process_name_t *proc,
OPAL_DECLSPEC int opal_db_base_store_pointer(opal_identifier_t proc,
opal_db_locality_t locality,
opal_value_t *kv);
ORTE_DECLSPEC int orte_db_base_fetch(const orte_process_name_t *proc,
OPAL_DECLSPEC int opal_db_base_fetch(opal_identifier_t proc,
const char *key, void **data,
opal_data_type_t type);
ORTE_DECLSPEC int orte_db_base_fetch_pointer(const orte_process_name_t *proc,
OPAL_DECLSPEC int opal_db_base_fetch_pointer(opal_identifier_t proc,
const char *key,
void **data, opal_data_type_t type);
ORTE_DECLSPEC int orte_db_base_fetch_multiple(const orte_process_name_t *proc,
OPAL_DECLSPEC int opal_db_base_fetch_multiple(opal_identifier_t proc,
const char *key,
opal_list_t *kvs);
ORTE_DECLSPEC int orte_db_base_remove_data(const orte_process_name_t *proc,
OPAL_DECLSPEC int opal_db_base_remove_data(opal_identifier_t proc,
const char *key);
ORTE_DECLSPEC int orte_db_base_add_log(const char *table,
OPAL_DECLSPEC int opal_db_base_add_log(const char *table,
const opal_value_t *kvs, int nkvs);

43
opal/mca/db/base/db_base_close.c Обычный файл
Просмотреть файл

@ -0,0 +1,43 @@
/*
* Copyright (c) 2010 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2012 Los Alamos National Security, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "opal_config.h"
#include "opal/constants.h"
#include <stdio.h>
#include "opal/mca/mca.h"
#include "opal/util/output.h"
#include "opal/mca/base/base.h"
#include "opal/mca/base/mca_base_component_repository.h"
#include "opal/mca/db/base/base.h"
extern opal_list_t opal_db_base_components_available;
int
opal_db_base_close(void)
{
if (NULL != opal_db.finalize) {
opal_db.finalize();
}
mca_base_components_close(opal_db_base.output,
&opal_db_base.available_components, NULL);
OBJ_DESTRUCT(&opal_db_base.available_components);
/* Close the framework output */
opal_output_close (opal_db_base.output);
opal_db_base.output = -1;
return OPAL_SUCCESS;
}

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

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012 Los Alamos National Security, Inc. All rights reserved.
* Copyright (c) 2012-2013 Los Alamos National Security, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -8,277 +8,250 @@
*/
#include "orte_config.h"
#include "orte/constants.h"
#include "opal_config.h"
#include "opal/constants.h"
#include "opal/mca/mca.h"
#include "opal/util/error.h"
#include "opal/util/output.h"
#include "opal/mca/base/base.h"
#include "opal/dss/dss_types.h"
#include "orte/mca/errmgr/errmgr.h"
#include "orte/mca/db/base/base.h"
#include "opal/mca/db/base/base.h"
int orte_db_base_store(const orte_process_name_t *proc,
int opal_db_base_store(opal_identifier_t proc,
opal_db_locality_t locality,
const char *key, const void *object,
opal_data_type_t type)
{
bool did_op;
opal_list_item_t *item;
orte_db_active_module_t *mod;
opal_db_active_module_t *mod;
int rc;
/* cycle thru the actiove modules until one agrees to perform the op */
did_op = false;
for (item = opal_list_get_first(&orte_db_base.active_modules);
item != opal_list_get_end(&orte_db_base.active_modules);
item = opal_list_get_next(item)) {
mod = (orte_db_active_module_t*)item;
OPAL_LIST_FOREACH(mod, &opal_db_base.store_order, opal_db_active_module_t) {
if (NULL == mod->module->store) {
continue;
}
if (ORTE_SUCCESS == (rc = mod->module->store(proc, key, object, type))) {
if (OPAL_SUCCESS == (rc = mod->module->store(proc, locality, key, object, type))) {
did_op = true;
break;
}
/* modules return "next option" if they didn't perform
* the operation - anything else is a true error.
*/
if (ORTE_ERR_TAKE_NEXT_OPTION != rc) {
ORTE_ERROR_LOG(rc);
if (OPAL_ERR_TAKE_NEXT_OPTION != rc) {
OPAL_ERROR_LOG(rc);
return rc;
}
}
/* if we get here without performing the operation, that's an error */
if (!did_op) {
ORTE_ERROR_LOG(ORTE_ERROR);
return ORTE_ERROR;
OPAL_ERROR_LOG(OPAL_ERROR);
return OPAL_ERROR;
}
return ORTE_SUCCESS;
return OPAL_SUCCESS;
}
int orte_db_base_store_pointer(const orte_process_name_t *proc,
int opal_db_base_store_pointer(opal_identifier_t proc,
opal_db_locality_t locality,
opal_value_t *kv)
{
bool did_op;
opal_list_item_t *item;
orte_db_active_module_t *mod;
opal_db_active_module_t *mod;
int rc;
/* cycle thru the actiove modules until one agrees to perform the op */
did_op = false;
for (item = opal_list_get_first(&orte_db_base.active_modules);
item != opal_list_get_end(&orte_db_base.active_modules);
item = opal_list_get_next(item)) {
mod = (orte_db_active_module_t*)item;
OPAL_LIST_FOREACH(mod, &opal_db_base.store_order, opal_db_active_module_t) {
if (NULL == mod->module->store_pointer) {
continue;
}
if (ORTE_SUCCESS == (rc = mod->module->store_pointer(proc, kv))) {
if (OPAL_SUCCESS == (rc = mod->module->store_pointer(proc, locality, kv))) {
did_op = true;
break;
}
/* modules return "next option" if they didn't perform
* the operation - anything else is a true error.
*/
if (ORTE_ERR_TAKE_NEXT_OPTION != rc) {
ORTE_ERROR_LOG(rc);
if (OPAL_ERR_TAKE_NEXT_OPTION != rc) {
OPAL_ERROR_LOG(rc);
return rc;
}
}
/* if we get here without performing the operation, that's an error */
if (!did_op) {
ORTE_ERROR_LOG(ORTE_ERROR);
return ORTE_ERROR;
OPAL_ERROR_LOG(OPAL_ERROR);
return OPAL_ERROR;
}
return ORTE_SUCCESS;
return OPAL_SUCCESS;
}
int orte_db_base_fetch(const orte_process_name_t *proc,
int opal_db_base_fetch(opal_identifier_t proc,
const char *key, void **data,
opal_data_type_t type)
{
bool did_op;
opal_list_item_t *item;
orte_db_active_module_t *mod;
opal_db_active_module_t *mod;
int rc;
/* cycle thru the actiove modules until one agrees to perform the op */
did_op = false;
for (item = opal_list_get_first(&orte_db_base.active_modules);
item != opal_list_get_end(&orte_db_base.active_modules);
item = opal_list_get_next(item)) {
mod = (orte_db_active_module_t*)item;
OPAL_LIST_FOREACH(mod, &opal_db_base.fetch_order, opal_db_active_module_t) {
if (NULL == mod->module->fetch) {
continue;
}
if (ORTE_SUCCESS == (rc = mod->module->fetch(proc, key, data, type))) {
if (OPAL_SUCCESS == (rc = mod->module->fetch(proc, key, data, type))) {
did_op = true;
break;
}
/* modules return "next option" if they didn't perform
* the operation - anything else is a true error.
*/
if (ORTE_ERR_TAKE_NEXT_OPTION != rc) {
ORTE_ERROR_LOG(rc);
if (OPAL_ERR_TAKE_NEXT_OPTION != rc) {
OPAL_ERROR_LOG(rc);
return rc;
}
}
/* if we get here without performing the operation, that's an error */
if (!did_op) {
ORTE_ERROR_LOG(ORTE_ERROR);
return ORTE_ERROR;
OPAL_ERROR_LOG(OPAL_ERR_DATA_VALUE_NOT_FOUND);
return OPAL_ERR_DATA_VALUE_NOT_FOUND;
}
return ORTE_SUCCESS;
return OPAL_SUCCESS;
}
int orte_db_base_fetch_pointer(const orte_process_name_t *proc,
int opal_db_base_fetch_pointer(opal_identifier_t proc,
const char *key,
void **data, opal_data_type_t type)
{
bool did_op;
opal_list_item_t *item;
orte_db_active_module_t *mod;
opal_db_active_module_t *mod;
int rc;
/* cycle thru the actiove modules until one agrees to perform the op */
did_op = false;
for (item = opal_list_get_first(&orte_db_base.active_modules);
item != opal_list_get_end(&orte_db_base.active_modules);
item = opal_list_get_next(item)) {
mod = (orte_db_active_module_t*)item;
OPAL_LIST_FOREACH(mod, &opal_db_base.fetch_order, opal_db_active_module_t) {
if (NULL == mod->module->fetch_pointer) {
continue;
}
if (ORTE_SUCCESS == (rc = mod->module->fetch_pointer(proc, key, data, type))) {
if (OPAL_SUCCESS == (rc = mod->module->fetch_pointer(proc, key, data, type))) {
did_op = true;
break;
}
/* modules return "next option" if they didn't perform
* the operation - anything else is a true error.
*/
if (ORTE_ERR_TAKE_NEXT_OPTION != rc) {
ORTE_ERROR_LOG(rc);
if (OPAL_ERR_TAKE_NEXT_OPTION != rc) {
OPAL_ERROR_LOG(rc);
return rc;
}
}
/* if we get here without performing the operation, that's an error */
if (!did_op) {
ORTE_ERROR_LOG(ORTE_ERROR);
return ORTE_ERROR;
OPAL_ERROR_LOG(OPAL_ERR_DATA_VALUE_NOT_FOUND);
return OPAL_ERR_DATA_VALUE_NOT_FOUND;
}
return ORTE_SUCCESS;
return OPAL_SUCCESS;
}
int orte_db_base_fetch_multiple(const orte_process_name_t *proc,
int opal_db_base_fetch_multiple(opal_identifier_t proc,
const char *key,
opal_list_t *kvs)
{
bool did_op;
opal_list_item_t *item;
orte_db_active_module_t *mod;
opal_db_active_module_t *mod;
int rc;
/* cycle thru the actiove modules until one agrees to perform the op */
did_op = false;
for (item = opal_list_get_first(&orte_db_base.active_modules);
item != opal_list_get_end(&orte_db_base.active_modules);
item = opal_list_get_next(item)) {
mod = (orte_db_active_module_t*)item;
OPAL_LIST_FOREACH(mod, &opal_db_base.fetch_order, opal_db_active_module_t) {
if (NULL == mod->module->fetch_multiple) {
continue;
}
if (ORTE_SUCCESS == (rc = mod->module->fetch_multiple(proc, key, kvs))) {
if (OPAL_SUCCESS == (rc = mod->module->fetch_multiple(proc, key, kvs))) {
did_op = true;
break;
}
/* modules return "next option" if they didn't perform
* the operation - anything else is a true error.
*/
if (ORTE_ERR_TAKE_NEXT_OPTION != rc) {
ORTE_ERROR_LOG(rc);
if (OPAL_ERR_TAKE_NEXT_OPTION != rc) {
OPAL_ERROR_LOG(rc);
return rc;
}
}
/* if we get here without performing the operation, that's an error */
if (!did_op) {
ORTE_ERROR_LOG(ORTE_ERROR);
return ORTE_ERROR;
OPAL_ERROR_LOG(OPAL_ERR_DATA_VALUE_NOT_FOUND);
return OPAL_ERR_DATA_VALUE_NOT_FOUND;
}
return ORTE_SUCCESS;
return OPAL_SUCCESS;
}
int orte_db_base_remove_data(const orte_process_name_t *proc,
int opal_db_base_remove_data(opal_identifier_t proc,
const char *key)
{
bool did_op;
opal_list_item_t *item;
orte_db_active_module_t *mod;
opal_db_active_module_t *mod;
int rc;
/* cycle thru the actiove modules until one agrees to perform the op */
did_op = false;
for (item = opal_list_get_first(&orte_db_base.active_modules);
item != opal_list_get_end(&orte_db_base.active_modules);
item = opal_list_get_next(item)) {
mod = (orte_db_active_module_t*)item;
OPAL_LIST_FOREACH(mod, &opal_db_base.store_order, opal_db_active_module_t) {
if (NULL == mod->module->remove) {
continue;
}
if (ORTE_SUCCESS == (rc = mod->module->remove(proc, key))) {
if (OPAL_SUCCESS == (rc = mod->module->remove(proc, key))) {
did_op = true;
break;
}
/* modules return "next option" if they didn't perform
* the operation - anything else is a true error.
*/
if (ORTE_ERR_TAKE_NEXT_OPTION != rc) {
ORTE_ERROR_LOG(rc);
if (OPAL_ERR_TAKE_NEXT_OPTION != rc) {
OPAL_ERROR_LOG(rc);
return rc;
}
}
/* if we get here without performing the operation, that's an error */
if (!did_op) {
ORTE_ERROR_LOG(ORTE_ERROR);
return ORTE_ERROR;
OPAL_ERROR_LOG(OPAL_ERROR);
return OPAL_ERROR;
}
return ORTE_SUCCESS;
return OPAL_SUCCESS;
}
int orte_db_base_add_log(const char *table,
int opal_db_base_add_log(const char *table,
const opal_value_t *kvs, int nkvs)
{
bool did_op;
opal_list_item_t *item;
orte_db_active_module_t *mod;
opal_db_active_module_t *mod;
int rc;
/* cycle thru the active modules until one agrees to perform the op */
did_op = false;
for (item = opal_list_get_first(&orte_db_base.active_modules);
item != opal_list_get_end(&orte_db_base.active_modules);
item = opal_list_get_next(item)) {
mod = (orte_db_active_module_t*)item;
OPAL_LIST_FOREACH(mod, &opal_db_base.store_order, opal_db_active_module_t) {
if (NULL == mod->module->add_log) {
continue;
}
if (ORTE_SUCCESS == (rc = mod->module->add_log(table, kvs, nkvs))) {
if (OPAL_SUCCESS == (rc = mod->module->add_log(table, kvs, nkvs))) {
did_op = true;
break;
}
/* modules return "next option" if they didn't perform
* the operation - anything else is a true error.
*/
if (ORTE_ERR_TAKE_NEXT_OPTION != rc) {
if (OPAL_ERR_TAKE_NEXT_OPTION != rc) {
/* don't error log it here */
return rc;
}
@ -287,7 +260,7 @@ int orte_db_base_add_log(const char *table,
/* if we get here without performing the operation, let the caller know */
if (!did_op) {
/* don't error log it here */
return ORTE_ERROR;
return OPAL_ERROR;
}
return ORTE_SUCCESS;
return OPAL_SUCCESS;
}

65
opal/mca/db/base/db_base_open.c Обычный файл
Просмотреть файл

@ -0,0 +1,65 @@
/*
* Copyright (c) 2010 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2012-2013 Los Alamos National Security, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "opal_config.h"
#include "opal/constants.h"
#include "opal/mca/mca.h"
#include "opal/util/output.h"
#include "opal/mca/base/base.h"
#include "opal/dss/dss_types.h"
#include "opal/mca/db/base/base.h"
/*
* The following file was created by configure. It contains extern
* dbments and the definition of an array of pointers to each
* module's public mca_base_module_t struct.
*/
#include "opal/mca/db/base/static-components.h"
opal_db_base_module_t opal_db = {
NULL,
NULL,
opal_db_base_store,
opal_db_base_store_pointer,
opal_db_base_fetch,
opal_db_base_fetch_pointer,
opal_db_base_fetch_multiple,
opal_db_base_remove_data,
opal_db_base_add_log
};
opal_db_base_t opal_db_base;
int opal_db_base_open(void)
{
opal_db_base.output = opal_output_open(NULL);
OBJ_CONSTRUCT(&opal_db_base.available_components, opal_list_t);
OBJ_CONSTRUCT(&opal_db_base.fetch_order, opal_list_t);
OBJ_CONSTRUCT(&opal_db_base.store_order, opal_list_t);
/* Open up all available components */
if (OPAL_SUCCESS !=
mca_base_components_open("db", opal_db_base.output, mca_db_base_static_components,
&opal_db_base.available_components,
true)) {
return OPAL_ERROR;
}
return OPAL_SUCCESS;
}
OBJ_CLASS_INSTANCE(opal_db_active_module_t,
opal_list_item_t,
NULL, NULL);

134
opal/mca/db/base/db_base_select.c Обычный файл
Просмотреть файл

@ -0,0 +1,134 @@
/*
* Copyright (c) 2010 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2012-2013 Los Alamos National Security, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "opal_config.h"
#include "opal/constants.h"
#include "opal/class/opal_list.h"
#include "opal/mca/mca.h"
#include "opal/mca/base/base.h"
#include "opal/mca/base/mca_base_component_repository.h"
#include "opal/mca/db/base/base.h"
static bool selected = false;
int
opal_db_base_select(void)
{
mca_base_component_list_item_t *cli = NULL;
opal_db_base_component_t *component = NULL;
opal_db_base_module_t *module = NULL;
opal_db_active_module_t *nmodule, *mod;
int rc, fetch, store;
bool inserted;
if (selected) {
/* ensure we don't do this twice */
return OPAL_SUCCESS;
}
selected = true;
/* Query all available components and ask if they have a module */
OPAL_LIST_FOREACH(cli, &opal_db_base.available_components, mca_base_component_list_item_t) {
component = (opal_db_base_component_t *) cli->cli_component;
opal_output_verbose(5, opal_db_base.output,
"mca:db:select: checking available component %s",
component->base_version.mca_component_name);
/* If there's no query function, skip it */
if (NULL == component->query) {
opal_output_verbose(5, opal_db_base.output,
"mca:db:select: Skipping component [%s]. It does not implement a query function",
component->base_version.mca_component_name );
continue;
}
/* Query the component */
opal_output_verbose(5, opal_db_base.output,
"mca:db:select: Querying component [%s]",
component->base_version.mca_component_name);
rc = component->query(&module, &store, &fetch);
/* If no module was returned, then skip component */
if (OPAL_SUCCESS != rc || NULL == module) {
opal_output_verbose(5, opal_db_base.output,
"mca:db:select: Skipping component [%s]. Query failed to return a module",
component->base_version.mca_component_name );
continue;
}
/* attempt to initialize the module */
if (NULL != module->init) {
if (OPAL_SUCCESS != (rc = module->init())) {
/* skip the module */
continue;
}
}
/* If we got a module, add to the store list */
nmodule = OBJ_NEW(opal_db_active_module_t);
nmodule->pri = store;
nmodule->module = module;
nmodule->component = component;
/* maintain priority order */
inserted = false;
OPAL_LIST_FOREACH(mod, &opal_db_base.store_order, opal_db_active_module_t) {
if (store > mod->pri) {
opal_list_insert_pos(&opal_db_base.store_order,
&mod->super, &nmodule->super);
inserted = true;
break;
}
}
if (!inserted) {
/* must be lowest priority - add to end */
opal_list_append(&opal_db_base.store_order, &nmodule->super);
}
/* do the same for fetch list */
nmodule = OBJ_NEW(opal_db_active_module_t);
nmodule->pri = fetch;
nmodule->module = module;
nmodule->component = component;
/* maintain priority order */
inserted = false;
OPAL_LIST_FOREACH(mod, &opal_db_base.fetch_order, opal_db_active_module_t) {
if (fetch > mod->pri) {
opal_list_insert_pos(&opal_db_base.fetch_order,
&mod->super, &nmodule->super);
inserted = true;
break;
}
}
if (!inserted) {
/* must be lowest priority - add to end */
opal_list_append(&opal_db_base.fetch_order, &nmodule->super);
}
}
if (4 < opal_output_get_verbosity(opal_db_base.output)) {
opal_output(0, "Final db priorities");
/* show the prioritized list */
OPAL_LIST_FOREACH(mod, &opal_db_base.store_order, opal_db_active_module_t) {
opal_output(0, "\tComponent: %s Store Priority: %d",
mod->component->base_version.mca_component_name, mod->pri);
}
OPAL_LIST_FOREACH(mod, &opal_db_base.fetch_order, opal_db_active_module_t) {
opal_output(0, "\tComponent: %s Fetch Priority: %d",
mod->component->base_version.mca_component_name, mod->pri);
}
}
return OPAL_SUCCESS;;
}

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

@ -8,12 +8,12 @@
#
# $HEADER$
#
# This is the US/English general help file for ORTE Errmgr HNP module.
# This is the US/English general help file for OPAL Errmgr HNP module.
#
[errmgr-hnp:unknown-job-error]
An error has occurred in an unknown job. This generally should not happen
except due to an internal ORTE error.
except due to an internal OPAL error.
Job state: %s
This information should probably be reported to the OMPI developers.
This information should probably be repopald to the OMPI developers.

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

@ -1,6 +1,6 @@
/*
* Copyright (c) 2010 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2012 Los Alamos National Security, Inc. All rights reserved.
* Copyright (c) 2012-2013 Los Alamos National Security, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -9,25 +9,25 @@
*/
/** @file:
*
* The OpenRTE Database Framework
* The Database Framework
*
*/
#ifndef ORTE_DB_H
#define ORTE_DB_H
#ifndef OPAL_DB_H
#define OPAL_DB_H
#include "orte_config.h"
#include "orte/types.h"
#include "opal_config.h"
#include "opal/types.h"
#include "opal/mca/mca.h"
#include "opal/dss/dss_types.h"
#include "orte/mca/db/db_types.h"
#include "opal/mca/db/db_types.h"
/**
* DATABASE DESIGN
*
* Data is always associated with a given orte process name. Individual
* Data is always associated with a given opal identifier. Individual
* modules may store the data local to the calling process, or on one
* or more remote sites. Time lags between when data is written and
* when it is available at a remote proc will therefore exist.
@ -35,30 +35,48 @@
BEGIN_C_DECLS
/* define a flag to indicate the scope of data being
* stored in the database. Three options are supported:
*
* GLOBAL: data is to be published such that any proc
* in the job can access it
* LOCAL: data is to be published such that any proc
* on the same node can access it
* INTERNAL: data is to be stored in this app only
*/
typedef enum {
OPAL_DB_GLOBAL,
OPAL_DB_LOCAL,
OPAL_DB_INTERNAL
} opal_db_locality_t;
/*
* Initialize the module
*/
typedef int (*orte_db_base_module_init_fn_t)(void);
typedef int (*opal_db_base_module_init_fn_t)(void);
/*
* Finalize the module
*/
typedef void (*orte_db_base_module_finalize_fn_t)(void);
typedef void (*opal_db_base_module_finalize_fn_t)(void);
/*
* Store a copy of data in the database - overwrites if already present. The data is
* copied into the database and therefore does not need to be preserved by
* the caller.
*/
typedef int (*orte_db_base_module_store_fn_t)(const orte_process_name_t *proc,
const char *key, const void *data, opal_data_type_t type);
typedef int (*opal_db_base_module_store_fn_t)(opal_identifier_t proc,
opal_db_locality_t locality,
const char *key, const void *data,
opal_data_type_t type);
/*
* Store a pointer to data in the database - data must be retained by the user.
* This allows users to share data across the code base without consuming
* additional memory, but while retaining local access
*/
typedef int (*orte_db_base_module_store_pointer_fn_t)(const orte_process_name_t *proc,
typedef int (*opal_db_base_module_store_pointer_fn_t)(opal_identifier_t proc,
opal_db_locality_t locality,
opal_value_t *kv);
/*
@ -68,7 +86,7 @@ typedef int (*orte_db_base_module_store_pointer_fn_t)(const orte_process_name_t
* are supported here as well. Caller is responsible for releasing any returned
* object.
*/
typedef int (*orte_db_base_module_fetch_fn_t)(const orte_process_name_t *proc,
typedef int (*opal_db_base_module_fetch_fn_t)(opal_identifier_t proc,
const char *key,
void **data, opal_data_type_t type);
@ -80,7 +98,7 @@ typedef int (*orte_db_base_module_fetch_fn_t)(const orte_process_name_t *proc,
* will directly alter information in the database! A local copy of the data should be made
* wherever modification is possible.
*/
typedef int (*orte_db_base_module_fetch_pointer_fn_t)(const orte_process_name_t *proc,
typedef int (*opal_db_base_module_fetch_pointer_fn_t)(opal_identifier_t proc,
const char *key,
void **data, opal_data_type_t type);
/*
@ -89,7 +107,7 @@ typedef int (*orte_db_base_module_fetch_pointer_fn_t)(const orte_process_name_t
* Retrieve data for the given proc associated with the specified key. Wildcards
* are supported here as well. Caller is responsible for releasing the objects on the list.
*/
typedef int (*orte_db_base_module_fetch_multiple_fn_t)(const orte_process_name_t *proc,
typedef int (*opal_db_base_module_fetch_multiple_fn_t)(opal_identifier_t proc,
const char *key,
opal_list_t *kvs);
@ -103,51 +121,58 @@ typedef int (*orte_db_base_module_fetch_multiple_fn_t)(const orte_process_name_t
* that ALL data in the database is to be purged. A WILDCARD vpid will delete all matching
* keys from that jobid. Etc.
*/
typedef int (*orte_db_base_module_remove_fn_t)(const orte_process_name_t *proc, const char *key);
typedef int (*opal_db_base_module_remove_fn_t)(opal_identifier_t proc, const char *key);
/*
* Log data
*
* Insert statistical, non-process oriented data into a logging system.
*/
typedef int (*orte_db_base_module_add_log_fn_t)(const char *table, const opal_value_t *kvs, int nkvs);
typedef int (*opal_db_base_module_add_log_fn_t)(const char *table, const opal_value_t *kvs, int nkvs);
/*
* the standard module data structure
*/
struct orte_db_base_module_1_0_0_t {
orte_db_base_module_init_fn_t init;
orte_db_base_module_finalize_fn_t finalize;
orte_db_base_module_store_fn_t store;
orte_db_base_module_store_pointer_fn_t store_pointer;
orte_db_base_module_fetch_fn_t fetch;
orte_db_base_module_fetch_pointer_fn_t fetch_pointer;
orte_db_base_module_fetch_multiple_fn_t fetch_multiple;
orte_db_base_module_remove_fn_t remove;
orte_db_base_module_add_log_fn_t add_log;
struct opal_db_base_module_1_0_0_t {
opal_db_base_module_init_fn_t init;
opal_db_base_module_finalize_fn_t finalize;
opal_db_base_module_store_fn_t store;
opal_db_base_module_store_pointer_fn_t store_pointer;
opal_db_base_module_fetch_fn_t fetch;
opal_db_base_module_fetch_pointer_fn_t fetch_pointer;
opal_db_base_module_fetch_multiple_fn_t fetch_multiple;
opal_db_base_module_remove_fn_t remove;
opal_db_base_module_add_log_fn_t add_log;
};
typedef struct orte_db_base_module_1_0_0_t orte_db_base_module_1_0_0_t;
typedef struct orte_db_base_module_1_0_0_t orte_db_base_module_t;
typedef struct opal_db_base_module_1_0_0_t opal_db_base_module_1_0_0_t;
typedef struct opal_db_base_module_1_0_0_t opal_db_base_module_t;
/* we need to get two priorities back from our components, so
* define a customized query function for our use
*/
typedef int (*opal_db_component_query_fn_t)(opal_db_base_module_t **module,
int *store_priority,
int *fetch_priority);
/*
* the standard component data structure
*/
struct orte_db_base_component_1_0_0_t {
struct opal_db_base_component_1_0_0_t {
mca_base_component_t base_version;
mca_base_component_data_t base_data;
opal_db_component_query_fn_t query;
};
typedef struct orte_db_base_component_1_0_0_t orte_db_base_component_1_0_0_t;
typedef struct orte_db_base_component_1_0_0_t orte_db_base_component_t;
typedef struct opal_db_base_component_1_0_0_t opal_db_base_component_1_0_0_t;
typedef struct opal_db_base_component_1_0_0_t opal_db_base_component_t;
/*
* Macro for use in components that are of type db
*/
#define ORTE_DB_BASE_VERSION_1_0_0 \
#define OPAL_DB_BASE_VERSION_1_0_0 \
MCA_BASE_VERSION_2_0_0, \
"db", 1, 0, 0
/* Global structure for accessing DB functions */
ORTE_DECLSPEC extern orte_db_base_module_t orte_db; /* holds selected module's function pointers */
OPAL_DECLSPEC extern opal_db_base_module_t opal_db; /* holds base function pointers */
END_C_DECLS

28
opal/mca/db/db_types.h Обычный файл
Просмотреть файл

@ -0,0 +1,28 @@
/*
* Copyright (c) 2012-2013 Los Alamos National Security, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
/** @file:
*
* The OPAL Database Framework
*
*/
#ifndef OPAL_DB_TYPES_H
#define OPAL_DB_TYPES_H
#include "opal_config.h"
#include "opal/types.h"
BEGIN_C_DECLS
typedef uint64_t opal_identifier_t;
END_C_DECLS
#endif

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

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

@ -18,7 +18,7 @@ sources = \
# mca_<type>_<name>.la (for DSO builds) or libmca_<type>_<name>.la
# (for static builds).
if MCA_BUILD_orte_db_hash_DSO
if MCA_BUILD_opal_db_hash_DSO
component_noinst =
component_install = mca_db_hash.la
else

557
opal/mca/db/hash/db_hash.c Обычный файл
Просмотреть файл

@ -0,0 +1,557 @@
/*
* Copyright (c) 2010 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2004-2011 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2011-2013 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*
*/
#include "opal_config.h"
#include "opal/constants.h"
#include <time.h>
#include <string.h>
#include "opal_stdint.h"
#include "opal/class/opal_hash_table.h"
#include "opal/class/opal_pointer_array.h"
#include "opal/dss/dss_types.h"
#include "opal/util/error.h"
#include "opal/util/output.h"
#include "opal/util/show_help.h"
#include "opal/mca/db/base/base.h"
#include "db_hash.h"
static int init(void);
static void finalize(void);
static int store(opal_identifier_t proc,
opal_db_locality_t locality,
const char *key, const void *object,
opal_data_type_t type);
static int store_pointer(opal_identifier_t proc,
opal_db_locality_t locality,
opal_value_t *kv);
static int fetch(opal_identifier_t proc,
const char *key, void **data, opal_data_type_t type);
static int fetch_pointer(opal_identifier_t proc,
const char *key,
void **data, opal_data_type_t type);
static int fetch_multiple(opal_identifier_t proc,
const char *key,
opal_list_t *kvs);
static int remove_data(opal_identifier_t proc, const char *key);
opal_db_base_module_t opal_db_hash_module = {
init,
finalize,
store,
store_pointer,
fetch,
fetch_pointer,
fetch_multiple,
remove_data,
NULL
};
/* Local "globals" */
static opal_hash_table_t hash_data;
/**
* Data for a particular opal process
* The name association is maintained in the
* proc_data hash table.
*/
typedef struct {
/** Structure can be put on lists (including in hash tables) */
opal_list_item_t super;
/* List of opal_value_t structures containing all data
received from this process, sorted by key. */
opal_list_t data;
} proc_data_t;
static void proc_data_construct(proc_data_t *ptr)
{
OBJ_CONSTRUCT(&ptr->data, opal_list_t);
}
static void proc_data_destruct(proc_data_t *ptr)
{
opal_list_item_t *item;
while (NULL != (item = opal_list_remove_first(&ptr->data))) {
OBJ_RELEASE(item);
}
OBJ_DESTRUCT(&ptr->data);
}
OBJ_CLASS_INSTANCE(proc_data_t, opal_list_item_t,
proc_data_construct, proc_data_destruct);
static int init(void)
{
OBJ_CONSTRUCT(&hash_data, opal_hash_table_t);
opal_hash_table_init(&hash_data, 256);
return OPAL_SUCCESS;
}
static void finalize(void)
{
opal_hash_table_remove_all(&hash_data);
OBJ_DESTRUCT(&hash_data);
}
/**
* Find data for a given key in a given proc_data_t
* container.
*/
static opal_value_t* lookup_keyval(proc_data_t *proc_data,
const char *key)
{
opal_value_t *kv = NULL;
for (kv = (opal_value_t *) opal_list_get_first(&proc_data->data);
kv != (opal_value_t *) opal_list_get_end(&proc_data->data);
kv = (opal_value_t *) opal_list_get_next(kv)) {
if (0 == strcmp(key, kv->key)) {
return kv;
}
}
return NULL;
}
/**
* Find proc_data_t container associated with given
* opal_identifier_t.
*/
static proc_data_t* lookup_opal_proc(opal_hash_table_t *jtable, opal_identifier_t id)
{
proc_data_t *proc_data = NULL;
opal_hash_table_get_value_uint64(jtable, id, (void**)&proc_data);
if (NULL == proc_data) {
/* The proc clearly exists, so create a data structure for it */
proc_data = OBJ_NEW(proc_data_t);
if (NULL == proc_data) {
opal_output(0, "db:hash:lookup_opal_proc: unable to allocate proc_data_t\n");
return NULL;
}
opal_hash_table_set_value_uint64(jtable, id, proc_data);
}
return proc_data;
}
static int store(const opal_identifier_t id,
opal_db_locality_t locality,
const char *key, const void *data,
opal_data_type_t type)
{
proc_data_t *proc_data;
opal_value_t *kv;
opal_byte_object_t *boptr;
/* we are at the bottom of the store priorities, so
* if this fell to us, we store it
*/
opal_output_verbose(1, opal_db_base.output,
"db:hash:store storing data for proc %" PRIu64 " at locality %d",
id, (int)locality);
/* lookup the proc data object for this proc */
if (NULL == (proc_data = lookup_opal_proc(&hash_data, id))) {
/* unrecoverable error */
OPAL_OUTPUT_VERBOSE((5, opal_db_base.output,
"db:hash:store: storing key %s[%s] for proc %" PRIu64 " unrecoverably failed",
key, opal_dss.lookup_data_type(type), id));
return OPAL_ERR_OUT_OF_RESOURCE;
}
/* see if we already have this key in the data - means we are updating
* a pre-existing value
*/
kv = lookup_keyval(proc_data, key);
OPAL_OUTPUT_VERBOSE((5, opal_db_base.output,
"db:hash:store: %s key %s[%s] for proc %" PRIu64 "",
(NULL == kv ? "storing" : "updating"),
key, opal_dss.lookup_data_type(type), id));
if (NULL != kv) {
opal_list_remove_item(&proc_data->data, &kv->super);
OBJ_RELEASE(kv);
}
kv = OBJ_NEW(opal_value_t);
kv->key = strdup(key);
opal_list_append(&proc_data->data, &kv->super);
/* the type could come in as an OPAL one (e.g., OPAL_VPID). Since
* the value is an OPAL definition, it cannot cover OPAL data
* types, so convert to the underlying OPAL type
*/
switch (type) {
case OPAL_STRING:
kv->type = OPAL_STRING;
if (NULL != data) {
kv->data.string = strdup( (const char *) data);
} else {
kv->data.string = NULL;
}
break;
case OPAL_UINT32:
if (NULL == data) {
OPAL_ERROR_LOG(OPAL_ERR_BAD_PARAM);
return OPAL_ERR_BAD_PARAM;
}
kv->type = OPAL_UINT32;
kv->data.uint32 = *(uint32_t*)data;
break;
case OPAL_UINT16:
if (NULL == data) {
OPAL_ERROR_LOG(OPAL_ERR_BAD_PARAM);
return OPAL_ERR_BAD_PARAM;
}
kv->type = OPAL_UINT16;
kv->data.uint16 = *(uint16_t*)(data);
break;
case OPAL_INT:
if (NULL == data) {
OPAL_ERROR_LOG(OPAL_ERR_BAD_PARAM);
return OPAL_ERR_BAD_PARAM;
}
kv->type = OPAL_INT;
kv->data.integer = *(int*)(data);
break;
case OPAL_UINT:
if (NULL == data) {
OPAL_ERROR_LOG(OPAL_ERR_BAD_PARAM);
return OPAL_ERR_BAD_PARAM;
}
kv->type = OPAL_UINT;
kv->data.uint = *(unsigned int*)(data);
break;
case OPAL_BYTE_OBJECT:
kv->type = OPAL_BYTE_OBJECT;
boptr = (opal_byte_object_t*)data;
if (NULL != boptr && NULL != boptr->bytes && 0 < boptr->size) {
kv->data.bo.bytes = (uint8_t *) malloc(boptr->size);
memcpy(kv->data.bo.bytes, boptr->bytes, boptr->size);
kv->data.bo.size = boptr->size;
} else {
kv->data.bo.bytes = NULL;
kv->data.bo.size = 0;
}
break;
default:
OPAL_ERROR_LOG(OPAL_ERR_NOT_SUPPORTED);
return OPAL_ERR_NOT_SUPPORTED;
}
return OPAL_SUCCESS;
}
static int store_pointer(opal_identifier_t id,
opal_db_locality_t locality,
opal_value_t *kv)
{
proc_data_t *proc_data;
opal_value_t *k2;
/* we are at the bottom of the store priorities, so
* if this fell to us, we store it
*/
opal_output_verbose(1, opal_db_base.output,
"db:hash:store storing data for proc %" PRIu64 " at locality %d",
id, (int)locality);
/* lookup the proc data object for this proc */
if (NULL == (proc_data = lookup_opal_proc(&hash_data, id))) {
/* unrecoverable error */
OPAL_OUTPUT_VERBOSE((5, opal_db_base.output,
"db:hash:store: storing key %s[%s] for proc %" PRIu64 " unrecoverably failed",
kv->key, opal_dss.lookup_data_type(kv->type), id));
return OPAL_ERR_OUT_OF_RESOURCE;
}
/* see if we already have this key in the data - means we are updating
* a pre-existing value
*/
k2 = lookup_keyval(proc_data, kv->key);
OPAL_OUTPUT_VERBOSE((5, opal_db_base.output,
"db:hash:store: %s pointer of key %s[%s] for proc %" PRIu64 "",
(NULL == k2 ? "storing" : "updating"),
kv->key, opal_dss.lookup_data_type(kv->type), id));
if (NULL != k2) {
opal_list_remove_item(&proc_data->data, &k2->super);
OBJ_RELEASE(k2);
}
opal_list_append(&proc_data->data, &kv->super);
return OPAL_SUCCESS;
}
static int fetch(opal_identifier_t id,
const char *key, void **data, opal_data_type_t type)
{
proc_data_t *proc_data;
opal_value_t *kv;
opal_byte_object_t *boptr;
OPAL_OUTPUT_VERBOSE((5, opal_db_base.output,
"db:hash:fetch: searching for key %s[%s] on proc %" PRIu64 "",
(NULL == key) ? "NULL" : key,
opal_dss.lookup_data_type(type), id));
/* if the key is NULL, that is an error */
if (NULL == key) {
OPAL_ERROR_LOG(OPAL_ERR_BAD_PARAM);
return OPAL_ERR_BAD_PARAM;
}
/* lookup the proc data object for this proc */
if (NULL == (proc_data = lookup_opal_proc(&hash_data, id))) {
/* maybe they can find it elsewhere */
return OPAL_ERR_TAKE_NEXT_OPTION;
}
/* find the value */
if (NULL == (kv = lookup_keyval(proc_data, key))) {
/* maybe they can find it elsewhere */
return OPAL_ERR_TAKE_NEXT_OPTION;
}
/* do the copy and check the type */
switch (type) {
case OPAL_STRING:
if (OPAL_STRING != kv->type) {
return OPAL_ERR_TYPE_MISMATCH;
}
if (NULL != kv->data.string) {
*data = strdup(kv->data.string);
} else {
*data = NULL;
}
break;
case OPAL_UINT32:
if (OPAL_UINT32 != kv->type) {
return OPAL_ERR_TYPE_MISMATCH;
}
memcpy(*data, &kv->data.uint32, 4);
break;
case OPAL_UINT16:
if (OPAL_UINT16 != kv->type) {
return OPAL_ERR_TYPE_MISMATCH;
}
memcpy(*data, &kv->data.uint16, 2);
break;
case OPAL_INT:
if (OPAL_INT != kv->type) {
return OPAL_ERR_TYPE_MISMATCH;
}
memcpy(*data, &kv->data.integer, sizeof(int));
break;
case OPAL_UINT:
if (OPAL_UINT != kv->type) {
return OPAL_ERR_TYPE_MISMATCH;
}
memcpy(*data, &kv->data.uint, sizeof(unsigned int));
break;
case OPAL_BYTE_OBJECT:
if (OPAL_BYTE_OBJECT != kv->type) {
return OPAL_ERR_TYPE_MISMATCH;
}
boptr = (opal_byte_object_t*)malloc(sizeof(opal_byte_object_t));
if (NULL != kv->data.bo.bytes && 0 < kv->data.bo.size) {
boptr->bytes = (uint8_t *) malloc(kv->data.bo.size);
memcpy(boptr->bytes, kv->data.bo.bytes, kv->data.bo.size);
boptr->size = kv->data.bo.size;
} else {
boptr->bytes = NULL;
boptr->size = 0;
}
*data = boptr;
break;
default:
OPAL_ERROR_LOG(OPAL_ERR_NOT_SUPPORTED);
return OPAL_ERR_NOT_SUPPORTED;
}
return OPAL_SUCCESS;
}
static int fetch_pointer(opal_identifier_t id,
const char *key,
void **data, opal_data_type_t type)
{
proc_data_t *proc_data;
opal_value_t *kv;
OPAL_OUTPUT_VERBOSE((5, opal_db_base.output,
"db:hash:fetch_pointer: searching for key %s on proc %" PRIu64 "",
(NULL == key) ? "NULL" : key, id));
/* if the key is NULL, that is an error */
if (NULL == key) {
OPAL_ERROR_LOG(OPAL_ERR_BAD_PARAM);
return OPAL_ERR_BAD_PARAM;
}
/* lookup the proc data object for this proc */
if (NULL == (proc_data = lookup_opal_proc(&hash_data, id))) {
/* look elsewhere */
return OPAL_ERR_TAKE_NEXT_OPTION;
}
/* find the value */
if (NULL == (kv = lookup_keyval(proc_data, key))) {
/* look elsewhere */
return OPAL_ERR_TAKE_NEXT_OPTION;
}
switch (type) {
case OPAL_STRING:
if (OPAL_STRING != kv->type) {
return OPAL_ERR_TYPE_MISMATCH;
}
*data = kv->data.string;
break;
case OPAL_UINT32:
if (OPAL_UINT32 != kv->type) {
return OPAL_ERR_TYPE_MISMATCH;
}
*data = &kv->data.uint32;
break;
case OPAL_UINT16:
if (OPAL_UINT16 != kv->type) {
return OPAL_ERR_TYPE_MISMATCH;
}
*data = &kv->data.uint16;
break;
case OPAL_INT:
if (OPAL_INT != kv->type) {
return OPAL_ERR_TYPE_MISMATCH;
}
*data = &kv->data.integer;
break;
case OPAL_UINT:
if (OPAL_UINT != kv->type) {
return OPAL_ERR_TYPE_MISMATCH;
}
*data = &kv->data.uint;
break;
case OPAL_BYTE_OBJECT:
if (OPAL_BYTE_OBJECT != kv->type) {
return OPAL_ERR_TYPE_MISMATCH;
}
*data = &kv->data.bo;
break;
default:
OPAL_ERROR_LOG(OPAL_ERR_NOT_SUPPORTED);
return OPAL_ERR_NOT_SUPPORTED;
}
return OPAL_SUCCESS;
}
static int fetch_multiple(opal_identifier_t id,
const char *key,
opal_list_t *kvs)
{
proc_data_t *proc_data;
opal_value_t *kv, *kvnew;
int rc;
char *srchkey, *ptr;
size_t len = 0;
OPAL_OUTPUT_VERBOSE((5, opal_db_base.output,
"db:hash:fetch_multiple: searching for key %s on proc %" PRIu64 "",
(NULL == key) ? "NULL" : key, id));
/* lookup the proc data object for this proc */
if (NULL == (proc_data = lookup_opal_proc(&hash_data, id))) {
/* look elsewhere */
return OPAL_ERR_TAKE_NEXT_OPTION;
}
/* if the key is NULL, then return all the values */
if (NULL == key) {
for (kv = (opal_value_t*) opal_list_get_first(&proc_data->data);
kv != (opal_value_t*) opal_list_get_end(&proc_data->data);
kv = (opal_value_t*) opal_list_get_next(kv)) {
if (OPAL_SUCCESS != (rc = opal_dss.copy((void**)&kvnew, kv, OPAL_VALUE))) {
OPAL_ERROR_LOG(rc);
return rc;
}
opal_list_append(kvs, &kvnew->super);
}
return OPAL_SUCCESS;
}
/* see if the key includes a wildcard */
srchkey = strdup(key);
if (NULL != (ptr = strchr(srchkey, '*'))) {
*ptr = '\0';
len = strlen(srchkey);
}
/* otherwise, find all matching keys and return them */
for (kv = (opal_value_t*) opal_list_get_first(&proc_data->data);
kv != (opal_value_t*) opal_list_get_end(&proc_data->data);
kv = (opal_value_t*) opal_list_get_next(kv)) {
if ((0 < len && 0 == strncmp(srchkey, kv->key, len)) ||
(0 == len && 0 == strcmp(key, kv->key))) {
if (OPAL_SUCCESS != (rc = opal_dss.copy((void**)&kvnew, kv, OPAL_VALUE))) {
OPAL_ERROR_LOG(rc);
return rc;
}
opal_list_append(kvs, &kvnew->super);
}
}
free(srchkey);
return OPAL_SUCCESS;
}
static int remove_data(opal_identifier_t id, const char *key)
{
proc_data_t *proc_data;
opal_value_t *kv;
/* lookup the specified proc */
if (NULL == (proc_data = lookup_opal_proc(&hash_data, id))) {
/* no data for this proc */
return OPAL_SUCCESS;
}
/* if key is NULL, remove all data for this proc */
if (NULL == key) {
while (NULL != (kv = (opal_value_t *) opal_list_remove_first(&proc_data->data))) {
OBJ_RELEASE(kv);
}
/* remove the proc_data object itself from the jtable */
opal_hash_table_remove_value_uint64(&hash_data, id);
/* cleanup */
OBJ_RELEASE(proc_data);
return OPAL_SUCCESS;
}
/* remove this item */
for (kv = (opal_value_t*) opal_list_get_first(&proc_data->data);
kv != (opal_value_t*) opal_list_get_end(&proc_data->data);
kv = (opal_value_t*) opal_list_get_next(kv)) {
if (0 == strcmp(key, kv->key)) {
OBJ_RELEASE(kv);
break;
}
}
return OPAL_SUCCESS;
}

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

@ -8,17 +8,17 @@
* $HEADER$
*/
#ifndef ORTE_DB_HASH_H
#define ORTE_DB_HASH_H
#ifndef OPAL_DB_HASH_H
#define OPAL_DB_HASH_H
#include "orte/mca/db/db.h"
#include "opal/mca/db/db.h"
BEGIN_C_DECLS
ORTE_MODULE_DECLSPEC extern orte_db_base_component_t mca_db_hash_component;
ORTE_DECLSPEC extern orte_db_base_module_t orte_db_hash_module;
OPAL_MODULE_DECLSPEC extern opal_db_base_component_t mca_db_hash_component;
OPAL_DECLSPEC extern opal_db_base_module_t opal_db_hash_module;
END_C_DECLS
#endif /* ORTE_DB_HASH_H */
#endif /* OPAL_DB_HASH_H */

107
opal/mca/db/hash/db_hash_component.c Обычный файл
Просмотреть файл

@ -0,0 +1,107 @@
/*
* Copyright (c) 2010 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2012 Los Alamos National Security, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*
* These symbols are in a file by themselves to provide nice linker
* semantics. Since linkers generally pull in symbols by object
* files, keeping these symbols as the only symbols in this file
* prevents utility programs such as "ompi_info" from having to import
* entire components just to query their version and parameters.
*/
#include "opal_config.h"
#include "opal/constants.h"
#include "opal/mca/base/base.h"
#include "opal/mca/db/db.h"
#include "opal/mca/db/base/base.h"
#include "db_hash.h"
static int db_hash_component_open(void);
static int db_hash_component_query(opal_db_base_module_t **module,
int *store_priority,
int *fetch_priority);
static int db_hash_component_close(void);
static int db_hash_component_register(void);
/*
* Instantiate the public struct with all of our public information
* and pointers to our public functions in it
*/
opal_db_base_component_t mca_db_hash_component = {
{
OPAL_DB_BASE_VERSION_1_0_0,
/* Component name and version */
"hash",
OPAL_MAJOR_VERSION,
OPAL_MINOR_VERSION,
OPAL_RELEASE_VERSION,
/* Component open and close functions */
db_hash_component_open,
db_hash_component_close,
NULL,
db_hash_component_register
},
{
/* The component is checkpoint ready */
MCA_BASE_METADATA_PARAM_CHECKPOINT
},
db_hash_component_query
};
/* we should be the last place to store data as
* it usually is stored globally, then can fall
* down to us if it is internal
*/
static int my_store_priority = 1;
/* we should be the first place to look for data
* in case we already have it - then try to fetch
* it globally if we don't
*/
static int my_fetch_priority = 100;
static int db_hash_component_open(void)
{
return OPAL_SUCCESS;
}
static int db_hash_component_query(opal_db_base_module_t **module,
int *store_priority,
int *fetch_priority)
{
/* we are the default - the ESS modules will set the db selection
* envar if they need someone else
*/
*store_priority = my_store_priority;
*fetch_priority = my_fetch_priority;
*module = &opal_db_hash_module;
return OPAL_SUCCESS;
}
static int db_hash_component_close(void)
{
return OPAL_SUCCESS;
}
static int db_hash_component_register(void)
{
mca_base_component_t *c = &mca_db_hash_component.base_version;
mca_base_param_reg_int(c, "store_priority",
"Priority dictating order in which store commands will given to database components",
false, false, my_store_priority, &my_store_priority);
mca_base_param_reg_int(c, "fetch_priority",
"Priority dictating order in which fetch commands will given to database components",
false, false, my_fetch_priority, &my_fetch_priority);
return OPAL_SUCCESS;
}

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

@ -16,7 +16,7 @@ sources = \
# mca_<type>_<name>.la (for DSO builds) or libmca_<type>_<name>.la
# (for static builds).
if MCA_BUILD_orte_db_pmi_DSO
if MCA_BUILD_opal_db_pmi_DSO
component_noinst =
component_install = mca_db_pmi.la
else
@ -29,7 +29,7 @@ mcacomponent_LTLIBRARIES = $(component_install)
mca_db_pmi_la_SOURCES = $(sources)
mca_db_pmi_la_LDFLAGS = -module -avoid-version $(db_pmi_LDFLAGS)
mca_db_pmi_la_LIBADD = $(db_pmi_LIBS) \
$(top_ompi_builddir)/orte/mca/common/pmi/libmca_common_pmi.la
$(top_ompi_builddir)/opal/mca/common/pmi/libmca_common_pmi.la
noinst_LTLIBRARIES = $(component_noinst)
libmca_db_pmi_la_SOURCES =$(sources)

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

@ -1,6 +1,6 @@
# -*- shell-script -*-
#
# Copyright (c) 2012 Los Alamos National Security, LLC.
# Copyright (c) 2012-2013 Los Alamos National Security, LLC.
# All rights reserved.
# $COPYRIGHT$
#
@ -10,10 +10,10 @@
#
# MCA_db_pmi_CONFIG([action-if-found], [action-if-not-found])
# -----------------------------------------------------------
AC_DEFUN([MCA_orte_db_pmi_CONFIG], [
AC_CONFIG_FILES([orte/mca/db/pmi/Makefile])
AC_DEFUN([MCA_opal_db_pmi_CONFIG], [
AC_CONFIG_FILES([opal/mca/db/pmi/Makefile])
ORTE_CHECK_PMI([db_pmi], [db_pmi_good=1], [db_pmi_good=0])
OPAL_CHECK_PMI([db_pmi], [db_pmi_good=1], [db_pmi_good=0])
# Evaluate succeed / fail
AS_IF([test "$db_pmi_good" = 1],

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

@ -1,7 +1,7 @@
/*
* Copyright (c) 2012 Los Alamos National Security, LLC. All rights
* Copyright (c) 2012-2013 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
* $COPYRIGHT$
*
* Additional copyrights may follow
*
@ -9,48 +9,50 @@
*
*/
#include "orte_config.h"
#include "orte/constants.h"
#include "opal_config.h"
#include "opal/constants.h"
#include <time.h>
#include <string.h>
#include <pmi.h>
#if WANT_CRAY_PMI2_EXT
#include <pmi2.h>
#endif
#include "opal_stdint.h"
#include "opal/class/opal_pointer_array.h"
#include "opal/dss/dss_types.h"
#include "opal/util/argv.h"
#include "opal/util/error.h"
#include "opal/util/output.h"
#include "opal/util/show_help.h"
#include "orte/util/show_help.h"
#include "orte/util/name_fns.h"
#include "orte/mca/errmgr/errmgr.h"
#include "orte/mca/common/pmi/common_pmi.h"
#include "orte/runtime/orte_globals.h"
#include "orte/runtime/orte_wait.h"
#include "orte/mca/db/base/base.h"
#include "opal/mca/common/pmi/common_pmi.h"
#include "opal/mca/db/base/base.h"
#include "db_pmi.h"
#define ORTE_PMI_PAD 10
#define OPAL_PMI_PAD 10
static int init(void);
static void finalize(void);
static int store(const orte_process_name_t *proc,
const char *key, const void *object, opal_data_type_t type);
static int store_pointer(const orte_process_name_t *proc,
static int store(opal_identifier_t id,
opal_db_locality_t locality,
const char *key, const void *object,
opal_data_type_t type);
static int store_pointer(opal_identifier_t proc,
opal_db_locality_t locality,
opal_value_t *kv);
static int fetch(const orte_process_name_t *proc,
static int fetch(opal_identifier_t proc,
const char *key, void **data, opal_data_type_t type);
static int fetch_pointer(const orte_process_name_t *proc,
static int fetch_pointer(opal_identifier_t proc,
const char *key,
void **data, opal_data_type_t type);
static int fetch_multiple(const orte_process_name_t *proc,
static int fetch_multiple(opal_identifier_t proc,
const char *key,
opal_list_t *kvs);
static int remove_data(const orte_process_name_t *proc, const char *key);
static int remove_data(opal_identifier_t proc, const char *key);
orte_db_base_module_t orte_db_pmi_module = {
opal_db_base_module_t opal_db_pmi_module = {
init,
finalize,
store,
@ -65,41 +67,12 @@ orte_db_base_module_t orte_db_pmi_module = {
static int pmi_encode(char *outdata, const void *val, size_t vallen);
static uint8_t* pmi_decode(char *data, size_t *retlen);
static int setup_pmi(void);
static char* setup_key(const orte_process_name_t *name, const char *key);
static char* setup_key(opal_identifier_t name, const char *key);
/* Local variables */
static char *pmi_kvs_name = NULL;
static int pmi_vallen_max = -1;
static int pmi_keylen_max = -1;
static opal_pointer_array_t local_data;
/* local data storage */
typedef struct {
opal_object_t super;
char *rmluri;
char *nodename;
opal_hwloc_level_t bind_level;
unsigned int bind_idx;
orte_local_rank_t local_rank;
orte_node_rank_t node_rank;
} local_data_t;
static void ld_con(local_data_t *ptr)
{
ptr->rmluri = NULL;
ptr->nodename = NULL;
}
static void ld_des(local_data_t *ptr)
{
if (NULL != ptr->rmluri) {
free(ptr->rmluri);
}
if (NULL != ptr->nodename) {
free(ptr->nodename);
}
}
OBJ_CLASS_INSTANCE(local_data_t,
opal_object_t,
ld_con, ld_des);
/* Because Cray uses PMI2 extensions for some, but not all,
* PMI functions, we define a set of wrappers for those
@ -135,35 +108,24 @@ static int init(void)
{
int rc;
if (ORTE_SUCCESS != (rc = setup_pmi())) {
ORTE_ERROR_LOG(rc);
if (OPAL_SUCCESS != (rc = setup_pmi())) {
OPAL_ERROR_LOG(rc);
}
OBJ_CONSTRUCT(&local_data, opal_pointer_array_t);
opal_pointer_array_init(&local_data, 1, INT_MAX, 2);
return rc;
}
static void finalize(void)
{
int i;
local_data_t *pdat;
if (NULL != pmi_kvs_name) {
free(pmi_kvs_name);
pmi_kvs_name = NULL;
}
for (i=0; i < local_data.size; i++) {
if (NULL != (pdat = (local_data_t*)opal_pointer_array_get_item(&local_data, i))) {
OBJ_RELEASE(pdat);
}
}
OBJ_DESTRUCT(&local_data);
}
static int store(const orte_process_name_t *proc,
static int store(opal_identifier_t proc,
opal_db_locality_t locality,
const char *key, const void *data, opal_data_type_t type)
{
int i, rc;
@ -174,14 +136,18 @@ static int store(const orte_process_name_t *proc,
char *pmikey, *tmpkey, *tmp, sav;
char **strdata=NULL;
OPAL_OUTPUT_VERBOSE((5, orte_db_base.output,
"%s db:pmi:store: storing key %s[%s] for proc %s",
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
key, opal_dss.lookup_data_type(type), ORTE_NAME_PRINT(proc)));
/* pass internal stores down to someone else */
if (OPAL_DB_INTERNAL == locality) {
return OPAL_ERR_TAKE_NEXT_OPTION;
}
if (NULL == (pmikey = setup_key(ORTE_PROC_MY_NAME, key))) {
ORTE_ERROR_LOG(ORTE_ERR_BAD_PARAM);
return ORTE_ERR_BAD_PARAM;
OPAL_OUTPUT_VERBOSE((5, opal_db_base.output,
"db:pmi:store: storing key %s[%s] for proc %" PRIu64 "",
key, opal_dss.lookup_data_type(type), proc));
if (NULL == (pmikey = setup_key(proc, key))) {
OPAL_ERROR_LOG(OPAL_ERR_BAD_PARAM);
return OPAL_ERR_BAD_PARAM;
}
switch (type) {
@ -236,11 +202,11 @@ static int store(const orte_process_name_t *proc,
localdata = strdup((char*)data);
#endif
str = localdata;
while (pmi_vallen_max < (int)(ORTE_PMI_PAD + strlen(str))) {
while (pmi_vallen_max < (int)(OPAL_PMI_PAD + strlen(str))) {
/* the string is too long, so we need to break it into
* multiple sections
*/
tmp = str + pmi_vallen_max - ORTE_PMI_PAD;
tmp = str + pmi_vallen_max - OPAL_PMI_PAD;
sav = *tmp;
*tmp = '\0';
opal_argv_append_nosize(&strdata, str);
@ -256,38 +222,36 @@ static int store(const orte_process_name_t *proc,
* required to hold the entire string
*/
asprintf(&pmidata, "%d:%s", opal_argv_count(strdata), strdata[0]);
OPAL_OUTPUT_VERBOSE((5, orte_db_base.output,
"%s db:pmi:store: storing key %s data %s",
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
OPAL_OUTPUT_VERBOSE((5, opal_db_base.output,
"db:pmi:store: storing key %s data %s",
pmikey, pmidata));
if (PMI_SUCCESS != (rc = kvs_put(pmikey, pmidata))) {
ORTE_PMI_ERROR(rc, "PMI_KVS_Put");
OPAL_PMI_ERROR(rc, "PMI_KVS_Put");
free(pmidata);
free(pmikey);
opal_argv_free(strdata);
return ORTE_ERROR;
return OPAL_ERROR;
}
free(pmidata);
/* for each remaining segment, augment the key with the index */
for (i=1; NULL != strdata[i]; i++) {
asprintf(&tmpkey, "%s:%d", pmikey, i);
OPAL_OUTPUT_VERBOSE((5, orte_db_base.output,
"%s db:pmi:store: storing key %s data %s",
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
OPAL_OUTPUT_VERBOSE((5, opal_db_base.output,
"db:pmi:store: storing key %s data %s",
pmikey, strdata[i]));
if (PMI_SUCCESS != (rc = kvs_put(tmpkey, strdata[i]))) {
ORTE_PMI_ERROR(rc, "PMI_KVS_Put");
OPAL_PMI_ERROR(rc, "PMI_KVS_Put");
free(pmikey);
opal_argv_free(strdata);
return ORTE_ERROR;
return OPAL_ERROR;
}
free(tmpkey);
}
free(pmikey);
opal_argv_free(strdata);
return ORTE_SUCCESS;
return OPAL_SUCCESS;
case OPAL_INT:
i64 = (int64_t)(*((int*)data));
@ -304,10 +268,6 @@ static int store(const orte_process_name_t *proc,
asprintf(&pmidata, "%ld", (long)i64);
break;
case ORTE_VPID:
asprintf(&pmidata, "%s", ORTE_VPID_PRINT(*((orte_vpid_t*)data)));
break;
case OPAL_UINT64:
ui64 = *((uint64_t*)data);
asprintf(&pmidata, "%lu", (unsigned long)ui64);
@ -326,46 +286,50 @@ static int store(const orte_process_name_t *proc,
case OPAL_BYTE_OBJECT:
bo = (opal_byte_object_t*)data;
pmidata = (char*)malloc(pmi_vallen_max*sizeof(char));
if (ORTE_SUCCESS != (rc = pmi_encode(pmidata, bo->bytes, bo->size))) {
ORTE_ERROR_LOG(rc);
if (OPAL_SUCCESS != (rc = pmi_encode(pmidata, bo->bytes, bo->size))) {
OPAL_ERROR_LOG(rc);
free(pmidata);
return rc;
}
break;
default:
ORTE_ERROR_LOG(ORTE_ERR_NOT_SUPPORTED);
return ORTE_ERR_NOT_SUPPORTED;
OPAL_ERROR_LOG(OPAL_ERR_NOT_SUPPORTED);
return OPAL_ERR_NOT_SUPPORTED;
}
OPAL_OUTPUT_VERBOSE((10, orte_db_base.output,
"%s PUTTING KEY %s DATA %s",
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
OPAL_OUTPUT_VERBOSE((10, opal_db_base.output,
"PUTTING KEY %s DATA %s",
pmikey, pmidata));
rc = kvs_put(pmikey, pmidata);
if (PMI_SUCCESS != rc) {
ORTE_PMI_ERROR(rc, "PMI_KVS_Put");
return ORTE_ERROR;
OPAL_PMI_ERROR(rc, "PMI_KVS_Put");
return OPAL_ERROR;
}
free(pmidata);
free(pmikey);
return ORTE_SUCCESS;
return OPAL_SUCCESS;
}
static int store_pointer(const orte_process_name_t *proc,
static int store_pointer(opal_identifier_t proc,
opal_db_locality_t locality,
opal_value_t *kv)
{
int rc;
OPAL_OUTPUT_VERBOSE((5, orte_db_base.output,
"%s db:pmi:store: storing pointer of key %s for proc %s",
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
kv->key, ORTE_NAME_PRINT(proc)));
/* pass internal stores down to someone else */
if (OPAL_DB_INTERNAL == locality) {
return OPAL_ERR_TAKE_NEXT_OPTION;
}
OPAL_OUTPUT_VERBOSE((5, opal_db_base.output,
"db:pmi:store: storing pointer of key %s for proc %" PRIu64 "",
kv->key, proc));
/* just push this to PMI */
if (ORTE_SUCCESS != (rc = store(proc, kv->key, (void*)&kv->data, kv->type))) {
ORTE_ERROR_LOG(rc);
if (OPAL_SUCCESS != (rc = store(proc, locality, kv->key, (void*)&kv->data, kv->type))) {
OPAL_ERROR_LOG(rc);
}
return rc;
}
@ -381,14 +345,13 @@ static char* fetch_string(const char *key)
/* the first section of the string has the original key, so fetch it */
if (PMI_SUCCESS != kvs_get(key, tmp_val, pmi_vallen_max)) {
ORTE_ERROR_LOG(ORTE_ERR_NOT_FOUND);
OPAL_ERROR_LOG(OPAL_ERR_NOT_FOUND);
free(tmp_val);
return NULL;
}
OPAL_OUTPUT_VERBOSE((5, orte_db_base.output,
"%s db:pmi:fetch_string: received key %s DATA %s",
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
OPAL_OUTPUT_VERBOSE((5, opal_db_base.output,
"db:pmi:fetch_string: received key %s DATA %s",
key, tmp_val));
/* the data in this section was prepended with the number of sections
@ -407,15 +370,14 @@ static char* fetch_string(const char *key)
asprintf(&tmpkey, "%s:%d", key, i);
/* fetch it */
if (PMI_SUCCESS != kvs_get(tmpkey, tmp_val, pmi_vallen_max)) {
ORTE_ERROR_LOG(ORTE_ERR_NOT_FOUND);
OPAL_ERROR_LOG(OPAL_ERR_NOT_FOUND);
free(tmp_val);
free(tmpkey);
free(data);
return NULL;
}
OPAL_OUTPUT_VERBOSE((5, orte_db_base.output,
"%s db:pmi:fetch_string: received key %s DATA %s",
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
OPAL_OUTPUT_VERBOSE((5, opal_db_base.output,
"db:pmi:fetch_string: received key %s DATA %s",
tmpkey, tmp_val));
/* add it to our data */
@ -477,195 +439,57 @@ static char* fetch_string(const char *key)
return data;
}
static local_data_t* fetch_rtedat(const orte_process_name_t *proc)
{
local_data_t *pdat;
char *pmikey, **fields;
char *tmp_val;
/* see if we already fetched the data for this proc */
if (NULL != (pdat = (local_data_t*)opal_pointer_array_get_item(&local_data, proc->vpid))) {
return pdat;
}
/* nope - go get it and break it down */
if (NULL == (pmikey = setup_key(proc, "RTE"))) {
ORTE_ERROR_LOG(ORTE_ERR_BAD_PARAM);
return NULL;
}
if (NULL == (tmp_val = fetch_string(pmikey))) {
ORTE_ERROR_LOG(ORTE_ERR_NOT_FOUND);
return NULL;
}
/* split on commas */
fields = opal_argv_split(tmp_val, ',');
free(tmp_val);
/* sanity check */
if (6 != opal_argv_count(fields)) {
ORTE_ERROR_LOG(ORTE_ERR_BAD_PARAM);
return NULL;
}
/* setup the data object */
pdat = OBJ_NEW(local_data_t);
/* first field is the URI */
pdat->rmluri = strdup(fields[0]);
/* next is the hostname */
pdat->nodename = strdup(fields[1]);
/* next is the bind level */
pdat->bind_level = strtol(fields[2], NULL, 10);
/* next is the bind index */
pdat->bind_idx = strtoul(fields[3], NULL, 10);
/* local rank */
pdat->local_rank = strtoul(fields[4], NULL, 10);
/* node rank */
pdat->node_rank = strtoul(fields[5], NULL, 10);
/* insert into the right place */
opal_pointer_array_set_item(&local_data, proc->vpid, pdat);
/* cleanup */
opal_argv_free(fields);
return pdat;
}
static int fetch(const orte_process_name_t *proc,
static int fetch(const opal_identifier_t proc,
const char *key, void **data, opal_data_type_t type)
{
int rc;
local_data_t *pdat;
opal_byte_object_t *boptr;
orte_vpid_t vpid;
uint16_t ui16;
uint32_t ui32;
int ival;
unsigned int uival;
char *pmikey;
char tmp_val[1024];
opal_hwloc_locality_t locality;
size_t sval;
OPAL_OUTPUT_VERBOSE((5, orte_db_base.output,
"%s db:pmi:fetch: searching for key %s[%s] on proc %s",
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
OPAL_OUTPUT_VERBOSE((5, opal_db_base.output,
"db:pmi:fetch: searching for key %s[%s] on proc %" PRIu64 "",
(NULL == key) ? "NULL" : key,
opal_dss.lookup_data_type(type),
ORTE_NAME_PRINT(proc)));
opal_dss.lookup_data_type(type), proc));
/* if the key is NULL, that is an error */
if (NULL == key) {
ORTE_ERROR_LOG(ORTE_ERR_BAD_PARAM);
return ORTE_ERR_BAD_PARAM;
}
/* a few keys are consolidated to reduce the number of entries being
* pushed to PMI. This is an unfortunate requirement when running at
* scale on a Cray as the default max number of keys is set too low.
* See the corresponding entry in orte/mca/grpcomm/pmi where the
* consolidation occurs.
*/
if (0 == strcmp(key, ORTE_DB_RMLURI)) {
if (NULL == (pdat = fetch_rtedat(proc))) {
return ORTE_ERR_NOT_FOUND;
}
*data = strdup(pdat->rmluri);
return ORTE_SUCCESS;
} else if (0 == strcmp(key, ORTE_DB_BIND_LEVEL)) {
if (NULL == (pdat = fetch_rtedat(proc))) {
return ORTE_ERR_NOT_FOUND;
}
memcpy(*data, &pdat->bind_level, sizeof(opal_hwloc_level_t));
return ORTE_SUCCESS;
} else if (0 == strcmp(key, ORTE_DB_BIND_INDEX)) {
if (NULL == (pdat = fetch_rtedat(proc))) {
return ORTE_ERR_NOT_FOUND;
}
memcpy(*data, &pdat->bind_idx, sizeof(unsigned int));
return ORTE_SUCCESS;
} else if (0 == strcmp(key, ORTE_DB_HOSTNAME)) {
if (NULL == (pdat = fetch_rtedat(proc))) {
return ORTE_ERR_NOT_FOUND;
}
*data = strdup(pdat->nodename);
return ORTE_SUCCESS;
} else if (0 == strcmp(key, ORTE_DB_LOCALRANK)) {
if (NULL == (pdat = fetch_rtedat(proc))) {
return ORTE_ERR_NOT_FOUND;
}
memcpy(*data, &pdat->local_rank, sizeof(orte_local_rank_t));
return ORTE_SUCCESS;
} else if (0 == strcmp(key, ORTE_DB_NODERANK)) {
if (NULL == (pdat = fetch_rtedat(proc))) {
return ORTE_ERR_NOT_FOUND;
}
memcpy(*data, &pdat->node_rank, sizeof(orte_node_rank_t));
return ORTE_SUCCESS;
}
/* if it is the locality key, then compute that value as it
* isn't something that gets pushed to PMI
*/
if (0 == strcmp(key, ORTE_DB_LOCALITY)) {
if (proc->jobid == ORTE_PROC_MY_NAME->jobid &&
proc->vpid == ORTE_PROC_MY_NAME->vpid) {
/* if this is for myself, then set locality to all */
locality = OPAL_PROC_ALL_LOCAL;
} else {
if (NULL == (pdat = fetch_rtedat(proc))) {
return ORTE_ERR_NOT_FOUND;
}
if (0 != strcmp(pdat->nodename, orte_process_info.nodename)) {
/* this is on a different node, then mark as non-local */
locality = OPAL_PROC_NON_LOCAL;
} else if (OPAL_HWLOC_NODE_LEVEL == pdat->bind_level) {
/* if we share a node, but we don't know anything more, then
* mark us as on the node as this is all we know
*/
locality = OPAL_PROC_ON_NODE;
} else {
/* determine relative location on our node */
locality = opal_hwloc_base_get_relative_locality(opal_hwloc_topology,
orte_process_info.bind_level,
orte_process_info.bind_idx,
pdat->bind_level, pdat->bind_idx);
}
}
memcpy(*data, &locality, sizeof(opal_hwloc_locality_t));
return ORTE_SUCCESS;
OPAL_ERROR_LOG(OPAL_ERR_BAD_PARAM);
return OPAL_ERR_BAD_PARAM;
}
/* setup the key */
if (NULL == (pmikey = setup_key(proc, key))) {
ORTE_ERROR_LOG(ORTE_ERR_BAD_PARAM);
return ORTE_ERR_BAD_PARAM;
OPAL_ERROR_LOG(OPAL_ERR_BAD_PARAM);
return OPAL_ERR_BAD_PARAM;
}
/* if it isn't an RTE key, then check to see if they are looking for a string */
/* check to see if they are looking for a string */
if (OPAL_STRING == type) {
/* might have been passed in multiple sections */
*data = fetch_string(pmikey);
free(pmikey);
return ORTE_SUCCESS;
return OPAL_SUCCESS;
}
/* otherwise, retrieve the pmi keyval */
if (NULL == (pmikey = setup_key(proc, key))) {
ORTE_ERROR_LOG(ORTE_ERR_BAD_PARAM);
return ORTE_ERR_BAD_PARAM;
OPAL_ERROR_LOG(OPAL_ERR_BAD_PARAM);
return OPAL_ERR_BAD_PARAM;
}
if (PMI_SUCCESS != kvs_get(pmikey, tmp_val, pmi_vallen_max)) {
ORTE_ERROR_LOG(ORTE_ERR_NOT_FOUND);
OPAL_ERROR_LOG(OPAL_ERR_NOT_FOUND);
free(pmikey);
return ORTE_ERR_NOT_FOUND;
return OPAL_ERR_NOT_FOUND;
}
free(pmikey);
/* return the value according to the provided type */
switch (type) {
case ORTE_VPID:
if (ORTE_SUCCESS != (rc = orte_util_convert_string_to_vpid(&vpid, tmp_val))) {
ORTE_ERROR_LOG(rc);
return rc;
}
memcpy(*data, &vpid, sizeof(orte_vpid_t));
break;
case OPAL_UINT32:
ui32 = (uint32_t)strtoul(tmp_val, NULL, 10);
memcpy(*data, &ui32, sizeof(uint32_t));
@ -690,64 +514,41 @@ static int fetch(const orte_process_name_t *proc,
*data = boptr;
break;
default:
ORTE_ERROR_LOG(ORTE_ERR_NOT_SUPPORTED);
return ORTE_ERR_NOT_SUPPORTED;
OPAL_ERROR_LOG(OPAL_ERR_NOT_SUPPORTED);
return OPAL_ERR_NOT_SUPPORTED;
}
return ORTE_SUCCESS;
return OPAL_SUCCESS;
}
/* the only current use for fetch_pointer is to retrieve the
* hostname for the process - so don't worry about other uses
* here just yet
*/
static int fetch_pointer(const orte_process_name_t *proc,
static int fetch_pointer(opal_identifier_t proc,
const char *key,
void **data, opal_data_type_t type)
{
local_data_t *pdat;
OPAL_OUTPUT_VERBOSE((5, orte_db_base.output,
"%s db:pmi:fetch_pointer: searching for key %s on proc %s",
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
(NULL == key) ? "NULL" : key, ORTE_NAME_PRINT(proc)));
/* if the key is NULL, that is an error */
if (NULL == key) {
ORTE_ERROR_LOG(ORTE_ERR_BAD_PARAM);
return ORTE_ERR_BAD_PARAM;
}
/* we only support hostname for now */
if (0 != strcmp(key, ORTE_DB_HOSTNAME)) {
return ORTE_ERR_NOT_SUPPORTED;
}
if (NULL == (pdat = fetch_rtedat(proc))) {
return ORTE_ERR_NOT_FOUND;
}
*data = pdat->nodename;
return ORTE_SUCCESS;
/* has to be provided from local storage */
return OPAL_ERR_TAKE_NEXT_OPTION;
}
static int fetch_multiple(const orte_process_name_t *proc,
static int fetch_multiple(opal_identifier_t proc,
const char *key,
opal_list_t *kvs)
{
OPAL_OUTPUT_VERBOSE((5, orte_db_base.output,
"%s db:pmi:fetch_multiple: searching for key %s on proc %s",
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
(NULL == key) ? "NULL" : key, ORTE_NAME_PRINT(proc)));
OPAL_OUTPUT_VERBOSE((5, opal_db_base.output,
"db:pmi:fetch_multiple: searching for key %s on proc %" PRIu64 "",
(NULL == key) ? "NULL" : key, proc));
return ORTE_ERR_NOT_SUPPORTED;
return OPAL_ERR_NOT_SUPPORTED;
}
static int remove_data(const orte_process_name_t *proc, const char *key)
static int remove_data(opal_identifier_t proc, const char *key)
{
/* nothing to do here */
return ORTE_SUCCESS;
return OPAL_SUCCESS;
}
static int setup_pmi(void)
@ -759,8 +560,8 @@ static int setup_pmi(void)
#else
rc = PMI_KVS_Get_value_length_max(&pmi_vallen_max);
if (PMI_SUCCESS != rc) {
ORTE_PMI_ERROR(rc, "PMI_Get_value_length_max");
return ORTE_ERROR;
OPAL_PMI_ERROR(rc, "PMI_Get_value_length_max");
return OPAL_ERROR;
}
#endif
@ -769,13 +570,13 @@ static int setup_pmi(void)
max_length = 1024;
#else
if (PMI_SUCCESS != (rc = PMI_KVS_Get_name_length_max(&max_length))) {
ORTE_PMI_ERROR(rc, "PMI_KVS_Get_name_length_max");
return ORTE_ERROR;
OPAL_PMI_ERROR(rc, "PMI_KVS_Get_name_length_max");
return OPAL_ERROR;
}
#endif
pmi_kvs_name = (char*)malloc(max_length);
if (NULL == pmi_kvs_name) {
return ORTE_ERR_OUT_OF_RESOURCE;
return OPAL_ERR_OUT_OF_RESOURCE;
}
#if WANT_CRAY_PMI2_EXT
@ -784,28 +585,28 @@ static int setup_pmi(void)
rc = PMI_KVS_Get_my_name(pmi_kvs_name,max_length);
#endif
if (PMI_SUCCESS != rc) {
ORTE_PMI_ERROR(rc, "PMI_KVS_Get_my_name");
return ORTE_ERROR;
OPAL_PMI_ERROR(rc, "PMI_KVS_Get_my_name");
return OPAL_ERROR;
}
#if WANT_CRAY_PMI2_EXT
pmi_keylen_max = PMI2_MAX_KEYLEN;
#else
if (PMI_SUCCESS != (rc = PMI_KVS_Get_key_length_max(&pmi_keylen_max))) {
ORTE_PMI_ERROR(rc, "PMI_KVS_Get_key_length_max");
return ORTE_ERROR;
OPAL_PMI_ERROR(rc, "PMI_KVS_Get_key_length_max");
return OPAL_ERROR;
}
#endif
return ORTE_SUCCESS;
return OPAL_SUCCESS;
}
static char* setup_key(const orte_process_name_t *name, const char *key)
static char* setup_key(opal_identifier_t name, const char *key)
{
char *pmi_kvs_key;
if (pmi_keylen_max <= asprintf(&pmi_kvs_key, "%s-%s",
ORTE_NAME_PRINT(name), key)) {
if (pmi_keylen_max <= asprintf(&pmi_kvs_key, "%" PRIu64 "-%s",
name, key)) {
free(pmi_kvs_key);
return NULL;
}
@ -885,7 +686,7 @@ static int pmi_encode(char *outdata, const void *val, size_t vallen) {
/* check for size */
if ((size_t)pmi_vallen_max < (2 + vallen * 4) / 3 + 1) {
return ORTE_ERR_BAD_PARAM;
return OPAL_ERR_BAD_PARAM;
}
for (i = 0 ; i < vallen ; i += 3, tmp += 4) {
@ -894,7 +695,7 @@ static int pmi_encode(char *outdata, const void *val, size_t vallen) {
tmp[0] = (unsigned char)'\0';
return ORTE_SUCCESS;
return OPAL_SUCCESS;
}
static uint8_t* pmi_decode (char *data, size_t *retlen) {

23
opal/mca/db/pmi/db_pmi.h Обычный файл
Просмотреть файл

@ -0,0 +1,23 @@
/*
* Copyright (c) 2012 Los Alamos National Security, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#ifndef OPAL_DB_PMI_H
#define OPAL_DB_PMI_H
#include "opal/mca/db/db.h"
BEGIN_C_DECLS
OPAL_MODULE_DECLSPEC extern opal_db_base_component_t mca_db_pmi_component;
OPAL_DECLSPEC extern opal_db_base_module_t opal_db_pmi_module;
END_C_DECLS
#endif /* OPAL_DB_PMI_H */

108
opal/mca/db/pmi/db_pmi_component.c Обычный файл
Просмотреть файл

@ -0,0 +1,108 @@
/*
* Copyright (c) 2012-2013 Los Alamos National Security, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "opal_config.h"
#include "opal/constants.h"
#include "opal/mca/base/base.h"
#include "opal/mca/common/pmi/common_pmi.h"
#include "opal/mca/db/db.h"
#include "opal/mca/db/base/base.h"
#include "db_pmi.h"
static int db_pmi_component_open(void);
static int db_pmi_component_query(opal_db_base_module_t **module,
int *store_priority,
int *fetch_priority);
static int db_pmi_component_close(void);
static int db_pmi_component_register(void);
/*
* Instantiate the public struct with all of our public information
* and pointers to our public functions in it
*/
opal_db_base_component_t mca_db_pmi_component = {
{
OPAL_DB_BASE_VERSION_1_0_0,
/* Component name and version */
"pmi",
OPAL_MAJOR_VERSION,
OPAL_MINOR_VERSION,
OPAL_RELEASE_VERSION,
/* Component open and close functions */
db_pmi_component_open,
db_pmi_component_close,
NULL,
db_pmi_component_register
},
{
/* The component is checkpoint ready */
MCA_BASE_METADATA_PARAM_CHECKPOINT
},
db_pmi_component_query
};
/* if we are to be used, someone external will set
* our store priority to a high level
*/
static int my_store_priority = 0;
/* fetch from us if not found elsewhere */
static int my_fetch_priority = 1;
static int db_pmi_component_open(void)
{
return OPAL_SUCCESS;
}
static int db_pmi_component_query(opal_db_base_module_t **module,
int *store_priority,
int *fetch_priority)
{
/* only use PMI if available - the ESS pmi module
* will force our selection if we are direct-launched
*/
if (mca_common_pmi_init()) {
*store_priority = my_store_priority;
*fetch_priority = my_fetch_priority;
*module = &opal_db_pmi_module;
return OPAL_SUCCESS;
}
*store_priority = 0;
*fetch_priority = 0;
*module = NULL;
return OPAL_ERROR;
}
static int db_pmi_component_close(void)
{
mca_common_pmi_finalize();
return OPAL_SUCCESS;
}
static int db_pmi_component_register(void)
{
mca_base_component_t *c = &mca_db_pmi_component.base_version;
mca_base_param_reg_int(c, "store_priority",
"Priority dictating order in which store commands will given to database components",
false, false, my_store_priority, &my_store_priority);
mca_base_param_reg_int(c, "fetch_priority",
"Priority dictating order in which fetch commands will given to database components",
false, false, my_fetch_priority, &my_fetch_priority);
return OPAL_SUCCESS;
}

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

@ -16,7 +16,7 @@ sources = \
# mca_<type>_<name>.la (for DSO builds) or libmca_<type>_<name>.la
# (for static builds).
if MCA_BUILD_orte_db_print_DSO
if MCA_BUILD_opal_db_print_DSO
component_noinst =
component_install = mca_db_print.la
else

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

@ -8,8 +8,8 @@
*
*/
#include "orte_config.h"
#include "orte/constants.h"
#include "opal_config.h"
#include "opal/constants.h"
#include <string.h>
#include <sys/types.h>
@ -28,11 +28,7 @@
#include "opal/util/argv.h"
#include "opal_stdint.h"
#include "orte/util/name_fns.h"
#include "orte/util/proc_info.h"
#include "orte/runtime/orte_globals.h"
#include "orte/mca/db/base/base.h"
#include "opal/mca/db/base/base.h"
#include "db_print.h"
static int init(void);
@ -40,7 +36,7 @@ static void finalize(void);
static int add_log(const char *table,
const opal_value_t *kvs, int nkvs);
orte_db_base_module_t orte_db_print_module = {
opal_db_base_module_t opal_db_print_module = {
init,
finalize,
NULL,
@ -66,10 +62,10 @@ static int init(void)
fpout = stderr;
} else if (NULL == (fpout = fopen(mca_db_print_component.filename, "w"))) {
opal_output(0, "ERROR: cannot open log file %s", mca_db_print_component.filename);
return ORTE_ERROR;
return OPAL_ERROR;
}
return ORTE_SUCCESS;
return OPAL_SUCCESS;
}
static void finalize(void)
@ -101,9 +97,8 @@ static int add_log(const char *table,
int i;
bool found;
opal_output_verbose(2, orte_db_base.output,
"%s Logging data for table %s",
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), table);
opal_output_verbose(2, opal_db_base.output,
"Logging data for table %s", table);
found = false;
for (i=0; i < tables.size; i++) {
@ -213,5 +208,5 @@ static int add_log(const char *table,
fprintf(fpout, "%s\n", vstr);
free(vstr);
return ORTE_SUCCESS;
return OPAL_SUCCESS;
}

27
opal/mca/db/print/db_print.h Обычный файл
Просмотреть файл

@ -0,0 +1,27 @@
/*
* Copyright (c) 2012-2013 Los Alamos National Security, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#ifndef OPAL_DB_PRINT_H
#define OPAL_DB_PRINT_H
#include "opal/mca/db/db.h"
BEGIN_C_DECLS
typedef struct {
opal_db_base_component_t super;
char *filename;
} opal_db_print_component_t;
OPAL_MODULE_DECLSPEC extern opal_db_print_component_t mca_db_print_component;
OPAL_DECLSPEC extern opal_db_base_module_t opal_db_print_module;
END_C_DECLS
#endif /* OPAL_DB_PRINT_H */

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

@ -13,48 +13,51 @@
* entire components just to query their version and parameters.
*/
#include "orte_config.h"
#include "orte/constants.h"
#include "opal_config.h"
#include "opal/constants.h"
#include "opal/mca/base/base.h"
#include "opal/mca/base/mca_base_param.h"
#include "orte/util/proc_info.h"
#include "orte/mca/db/db.h"
#include "orte/mca/db/base/base.h"
#include "opal/mca/db/db.h"
#include "opal/mca/db/base/base.h"
#include "db_print.h"
extern orte_db_base_module_t orte_db_print_module;
extern opal_db_base_module_t opal_db_print_module;
static int print_component_open(void);
static int print_component_close(void);
static int print_component_query(mca_base_module_t **module, int *priority);
static int print_component_query(opal_db_base_module_t **module,
int *store_priority,
int *fetch_priority);
static int print_component_register(void);
/*
* Instantiate the public struct with all of our public information
* and pointers to our public functions in it
*/
orte_db_print_component_t mca_db_print_component = {
opal_db_print_component_t mca_db_print_component = {
{
{
ORTE_DB_BASE_VERSION_1_0_0,
OPAL_DB_BASE_VERSION_1_0_0,
/* Component name and version */
"print",
ORTE_MAJOR_VERSION,
ORTE_MINOR_VERSION,
ORTE_RELEASE_VERSION,
OPAL_MAJOR_VERSION,
OPAL_MINOR_VERSION,
OPAL_RELEASE_VERSION,
/* Component open and close functions */
print_component_open,
print_component_close,
print_component_query
NULL,
print_component_register
},
{
/* The component is checkpoint ready */
MCA_BASE_METADATA_PARAM_CHECKPOINT
}
},
print_component_query
}
};
@ -66,21 +69,24 @@ static int print_component_open(void)
mca_base_param_reg_string(c, "file",
"Print to the indicated file (- => stdout, + => stderr)",
false, false, NULL, &mca_db_print_component.filename);
return ORTE_SUCCESS;
return OPAL_SUCCESS;
}
static int print_component_query(mca_base_module_t **module, int *priority)
/* this component is NEVER used for store or fetch */
static int print_component_query(opal_db_base_module_t **module,
int *store_priority,
int *fetch_priority)
{
if (NULL == mca_db_print_component.filename) {
*priority = 0;
*store_priority = 0;
*fetch_priority = 0;
*module = NULL;
return ORTE_ERROR;
return OPAL_ERROR;
}
/* put us at the top of the list */
*priority = 100;
*module = (mca_base_module_t*)&orte_db_print_module;
return ORTE_SUCCESS;
*store_priority = 0;
*fetch_priority = 0;
*module = &opal_db_print_module;
return OPAL_SUCCESS;
}
@ -89,6 +95,11 @@ static int print_component_close(void)
if (NULL != mca_db_print_component.filename) {
free(mca_db_print_component.filename);
}
return ORTE_SUCCESS;
return OPAL_SUCCESS;
}
static int print_component_register(void)
{
return OPAL_SUCCESS;
}

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

@ -18,7 +18,7 @@ sources = \
# mca_<type>_<name>.la (for DSO builds) or libmca_<type>_<name>.la
# (for static builds).
if MCA_BUILD_orte_db_sqlite_DSO
if MCA_BUILD_opal_db_sqlite_DSO
component_noinst =
component_install = mca_db_sqlite.la
else

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

@ -1,6 +1,6 @@
dnl -*- shell-script -*-
dnl
dnl Copyright (c) 2012 Los Alamos National Security, Inc. All rights reserved.
dnl Copyright (c) 2012-2013 Los Alamos National Security, Inc. All rights reserved.
dnl $COPYRIGHT$
dnl
dnl Additional copyrights may follow
@ -10,8 +10,8 @@ dnl
# MCA_db_sqlite_CONFIG([action-if-found], [action-if-not-found])
# -----------------------------------------------------------
AC_DEFUN([MCA_orte_db_sqlite_CONFIG], [
AC_CONFIG_FILES([orte/mca/db/sqlite/Makefile])
AC_DEFUN([MCA_opal_db_sqlite_CONFIG], [
AC_CONFIG_FILES([opal/mca/db/sqlite/Makefile])
AC_ARG_WITH([sqlite3],
[AC_HELP_STRING([--with-sqlite3],
@ -19,15 +19,15 @@ AC_DEFUN([MCA_orte_db_sqlite_CONFIG], [
[], with_sqlite3=no)
# do not build if rte is disabled or support not requested
AS_IF([test "$orte_without_full_support" = 0 -a "$with_sqlite3" != "no"],
AS_IF([test "$with_sqlite3" != "no"],
[AS_IF([test ! -z "$with_sqlite3" -a "$with_sqlite3" != "yes"],
[orte_check_sqlite3_dir="$with_sqlite3"])
[opal_check_sqlite3_dir="$with_sqlite3"])
OMPI_CHECK_PACKAGE([db_sqlite],
[sqlite3.h],
[sqlite3],
[sqlite3_open],
[],
[$orte_check_sqlite3_dir],
[$opal_check_sqlite3_dir],
[],
[$1],
[$2])],

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

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012 Los Alamos National Security, Inc. All rights reserved.
* Copyright (c) 2012-2013 Los Alamos National Security, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -8,8 +8,8 @@
*
*/
#include "orte_config.h"
#include "orte/constants.h"
#include "opal_config.h"
#include "opal/constants.h"
#include <string.h>
#include <sys/types.h>
@ -35,11 +35,11 @@
#include "opal/util/basename.h"
#include "opal/mca/pstat/base/base.h"
#include "orte/util/show_help.h"
#include "orte/mca/errmgr/base/base.h"
#include "orte/runtime/orte_globals.h"
#include "opal/util/show_help.h"
#include "opal/mca/errmgr/base/base.h"
#include "opal/runtime/opal_globals.h"
#include "orte/mca/db/base/base.h"
#include "opal/mca/db/base/base.h"
#include "db_sqlite.h"
static int init(void);
@ -47,7 +47,7 @@ static void finalize(void);
static int add_log(const char *table,
const opal_value_t *kvs, int nkvs);
orte_db_base_module_t orte_db_sqlite_module = {
opal_db_base_module_t opal_db_sqlite_module = {
init,
finalize,
NULL,
@ -70,7 +70,7 @@ static int init(void)
/* initialize sqlite3 */
if (SQLITE_OK != sqlite3_initialize()) {
return ORTE_ERR_UNREACH;
return OPAL_ERR_UNREACH;
}
/* check if sqlite was built thread-safe - if not, we won't
@ -90,12 +90,12 @@ static int init(void)
*/
for (i=0; i < nthreads; i++) {
if (SQLITE_OK != sqlite3_open(mca_db_sqlite_component.db_file, &dbhandles[i])) {
orte_show_help("help-db-sqlite.txt", "cannot-create-sqlite", true, mca_db_sqlite_component.db_file);
return ORTE_ERR_FILE_OPEN_FAILURE;
opal_show_help("help-db-sqlite.txt", "cannot-create-sqlite", true, mca_db_sqlite_component.db_file);
return OPAL_ERR_FILE_OPEN_FAILURE;
}
}
return ORTE_SUCCESS;
return OPAL_SUCCESS;
}
static void finalize(void)
@ -119,9 +119,9 @@ static int add_log(const char *table,
char *sql, **cmd = NULL, *tmp;
sqlite3_stmt *stmt;
opal_output_verbose(2, orte_db_base.output,
opal_output_verbose(2, opal_db_base.output,
"%s Logging data for table %s",
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), table);
OPAL_NAME_PRINT(OPAL_PROC_MY_NAME), table);
/* setup the insert statement */
for (i=0; i < nkvs; i++) {
@ -132,9 +132,9 @@ static int add_log(const char *table,
free(tmp);
opal_argv_free(cmd);
/* use the next worker thread */
ORTE_SQLITE_CMD(prepare_v2(dbhandles[active], sql, strlen(sql)+1, &stmt, NULL), dbhandles[active], &rc);
OPAL_SQLITE_CMD(prepare_v2(dbhandles[active], sql, strlen(sql)+1, &stmt, NULL), dbhandles[active], &rc);
if (SQLITE_OK != rc) {
return ORTE_ERROR;
return OPAL_ERROR;
}
/* cycle through the provided values and construct
@ -144,41 +144,41 @@ static int add_log(const char *table,
for (i=0; i < nkvs; i++) {
switch (kvs[i].type) {
case OPAL_STRING:
ORTE_SQLITE_CMD(bind_text(stmt, i, kvs[i].data.string, strlen(kvs[i].data.string), NULL),
OPAL_SQLITE_CMD(bind_text(stmt, i, kvs[i].data.string, strlen(kvs[i].data.string), NULL),
dbhandles[active], &rc);
break;
case OPAL_INT32:
ORTE_SQLITE_CMD(bind_int(stmt, i, kvs[i].data.int32), dbhandles[active], &rc);
OPAL_SQLITE_CMD(bind_int(stmt, i, kvs[i].data.int32), dbhandles[active], &rc);
break;
case OPAL_INT16:
ORTE_SQLITE_CMD(bind_int(stmt, i, kvs[i].data.int16), dbhandles[active], &rc);
OPAL_SQLITE_CMD(bind_int(stmt, i, kvs[i].data.int16), dbhandles[active], &rc);
break;
case OPAL_PID:
ORTE_SQLITE_CMD(bind_int64(stmt, i, kvs[i].data.pid), dbhandles[active], &rc);
OPAL_SQLITE_CMD(bind_int64(stmt, i, kvs[i].data.pid), dbhandles[active], &rc);
break;
case OPAL_INT64:
ORTE_SQLITE_CMD(bind_int64(stmt, i, kvs[i].data.int64), dbhandles[active], &rc);
OPAL_SQLITE_CMD(bind_int64(stmt, i, kvs[i].data.int64), dbhandles[active], &rc);
break;
case OPAL_FLOAT:
ORTE_SQLITE_CMD(bind_double(stmt, i, kvs[i].data.fval), dbhandles[active], &rc);
OPAL_SQLITE_CMD(bind_double(stmt, i, kvs[i].data.fval), dbhandles[active], &rc);
break;
case OPAL_TIMEVAL:
asprintf(&tmp, "%d.%06d", (int)kvs[i].data.tv.tv_sec, (int)kvs[i].data.tv.tv_usec);
ORTE_SQLITE_CMD(bind_text(stmt, i, tmp, strlen(tmp), NULL),
OPAL_SQLITE_CMD(bind_text(stmt, i, tmp, strlen(tmp), NULL),
dbhandles[active], &rc);
free(tmp);
break;
}
if (SQLITE_OK != rc) {
return ORTE_ERROR;
return OPAL_ERROR;
}
}
ORTE_SQLITE_OP(step(stmt), DONE, dbhandles[active], &rc);
OPAL_SQLITE_OP(step(stmt), DONE, dbhandles[active], &rc);
if (SQLITE_OK != rc) {
return ORTE_ERROR;
return OPAL_ERROR;
}
opal_output(0, "%s INSERTED ROW %d", ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), (int)sqlite3_last_insert_rowid(dbhandles[active]));
opal_output(0, "%s INSERTED ROW %d", OPAL_NAME_PRINT(OPAL_PROC_MY_NAME), (int)sqlite3_last_insert_rowid(dbhandles[active]));
/* cycle to the next worker thread */
active++;
@ -186,5 +186,5 @@ static int add_log(const char *table,
active = 0;
}
return ORTE_SUCCESS;
return OPAL_SUCCESS;
}

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

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012 Los Alamos National Security, Inc. All rights reserved.
* Copyright (c) 2012-2013 Los Alamos National Security, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -7,43 +7,43 @@
* $HEADER$
*/
#ifndef ORTE_DB_SQLITE_H
#define ORTE_DB_SQLITE_H
#ifndef OPAL_DB_SQLITE_H
#define OPAL_DB_SQLITE_H
#include "orte/mca/db/db.h"
#include "opal/mca/db/db.h"
BEGIN_C_DECLS
typedef struct {
orte_db_base_component_t super;
opal_db_base_component_t super;
int num_worker_threads;
char *db_file;
} orte_db_sqlite_component_t;
ORTE_MODULE_DECLSPEC extern orte_db_sqlite_component_t mca_db_sqlite_component;
} opal_db_sqlite_component_t;
OPAL_MODULE_DECLSPEC extern opal_db_sqlite_component_t mca_db_sqlite_component;
ORTE_DECLSPEC extern orte_db_base_module_t orte_db_sqlite_module;
OPAL_DECLSPEC extern opal_db_base_module_t opal_db_sqlite_module;
/* Macros for manipulating sqlite */
#define ORTE_SQLITE_CMD(f, db, r) \
#define OPAL_SQLITE_CMD(f, db, r) \
{ \
*(r) = sqlite3_ ## f; \
if (*(r) != SQLITE_OK) { \
opal_output(0, "%s: %s failed with status %d: %s", \
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), \
OPAL_NAME_PRINT(OPAL_PROC_MY_NAME), \
#f, *(r), sqlite3_errmsg(db)); \
} \
} \
#define ORTE_SQLITE_OP(f, x, db, r) \
#define OPAL_SQLITE_OP(f, x, db, r) \
{ \
*(r) = sqlite3_ ## f; \
if (*(r) != SQLITE_ ## x) { \
opal_output(0, "%s: %s failed with status %d: %s", \
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), \
OPAL_NAME_PRINT(OPAL_PROC_MY_NAME), \
#f, *(r), sqlite3_errmsg(db)); \
} \
} \
END_C_DECLS
#endif /* ORTE_DB_SQLITE_H */
#endif /* OPAL_DB_SQLITE_H */

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

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012 Los Alamos National Security, Inc. All rights reserved.
* Copyright (c) 2012-2013 Los Alamos National Security, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -13,66 +13,105 @@
* entire components just to query their version and parameters.
*/
#include "orte_config.h"
#include "orte/constants.h"
#include "opal_config.h"
#include "opal/constants.h"
#include <sys/stat.h>
#include "opal/mca/base/base.h"
#include "opal/mca/base/mca_base_param.h"
#include "orte/util/proc_info.h"
#include "orte/util/show_help.h"
#include "opal/util/proc_info.h"
#include "opal/util/show_help.h"
#include "orte/mca/db/db.h"
#include "orte/mca/db/base/base.h"
#include "opal/mca/db/db.h"
#include "opal/mca/db/base/base.h"
#include "db_sqlite.h"
extern orte_db_base_module_t orte_db_sqlite_module;
char *orte_db_sqlite_file;
extern opal_db_base_module_t opal_db_sqlite_module;
char *opal_db_sqlite_file;
static int sqlite_component_open(void);
static int sqlite_component_close(void);
static int sqlite_component_query(mca_base_module_t **module, int *priority);
static int sqlite_component_query(opal_db_base_module_t **module,
int *store_priority,
int *fetch_priority);
static int sqlite_component_register(void);
/*
* Instantiate the public struct with all of our public information
* and pointers to our public functions in it
*/
orte_db_sqlite_component_t mca_db_sqlite_component = {
opal_db_sqlite_component_t mca_db_sqlite_component = {
{
{
ORTE_DB_BASE_VERSION_1_0_0,
OPAL_DB_BASE_VERSION_1_0_0,
/* Component name and version */
"sqlite",
ORTE_MAJOR_VERSION,
ORTE_MINOR_VERSION,
ORTE_RELEASE_VERSION,
OPAL_MAJOR_VERSION,
OPAL_MINOR_VERSION,
OPAL_RELEASE_VERSION,
/* Component open and close functions */
sqlite_component_open,
sqlite_component_close,
sqlite_component_query
NULL,
sqlite_component_register
},
{
/* The component is checkpoint ready */
MCA_BASE_METADATA_PARAM_CHECKPOINT
}
},
sqlite_component_query
}
};
static int sqlite_component_open(void)
{
return ORTE_SUCCESS;
return OPAL_SUCCESS;
}
/* this component is NEVER used for store or fetch */
static int sqlite_component_query(opal_db_base_module_t **module,
int *store_priority,
int *fetch_priority)
{
struct stat buf;
*store_priority = 0;
*fetch_priority = 0;
if (NULL != mca_db_sqlite_component.db_file) {
/* if the database file doesn't exist, then we can't operate */
if (0 != stat(mca_db_sqlite_component.db_file, &buf)) {
/* not found */
opal_show_help("help-db-sqlite.txt", "file-not-found",
true, mca_db_sqlite_component.db_file);
*module = NULL;
return OPAL_ERROR;
}
*module = (mca_base_module_t*)&opal_db_sqlite_module;
return OPAL_SUCCESS;
}
*module = NULL;
return OPAL_ERROR;
}
static int sqlite_component_query(mca_base_module_t **module, int *priority)
static int sqlite_component_close(void)
{
if (NULL != mca_db_sqlite_component.db_file) {
free(mca_db_sqlite_component.db_file);
}
return OPAL_SUCCESS;
}
static int sqlite_component_register(void)
{
mca_base_component_t *c = &mca_db_sqlite_component.super.base_version;
struct stat buf;
/* retrieve the name of the file to be used */
mca_base_param_reg_string(c, "database",
@ -84,33 +123,6 @@ static int sqlite_component_query(mca_base_module_t **module, int *priority)
"Number of worker threads to be used",
false, false, 0, &mca_db_sqlite_component.num_worker_threads);
if (NULL != mca_db_sqlite_component.db_file) {
/* if the database file doesn't exist, then we can't operate */
if (0 != stat(mca_db_sqlite_component.db_file, &buf)) {
/* not found */
orte_show_help("help-db-sqlite.txt", "file-not-found",
true, mca_db_sqlite_component.db_file);
*priority = 0;
*module = NULL;
return ORTE_ERROR;
}
*priority = 1;
*module = (mca_base_module_t*)&orte_db_sqlite_module;
return ORTE_SUCCESS;
}
*priority = 0;
*module = NULL;
return ORTE_ERROR;
}
static int sqlite_component_close(void)
{
if (NULL != mca_db_sqlite_component.db_file) {
free(mca_db_sqlite_component.db_file);
}
return ORTE_SUCCESS;
return OPAL_SUCCESS;
}

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

@ -215,6 +215,15 @@ opal_err2str(int errnum, const char **errmsg)
case OPAL_ERR_NOT_BOUND:
retval = "Not bound";
break;
case OPAL_ERR_TAKE_NEXT_OPTION:
retval = "Take next option";
break;
case OPAL_ERR_PROC_ENTRY_NOT_FOUND:
retval = "Database entry not found";
break;
case OPAL_ERR_DATA_VALUE_NOT_FOUND:
retval = "Data for specified key not found";
break;
default:
retval = NULL;
}

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

@ -75,6 +75,11 @@ enum {
ORTE_ERR_MULTIPLE_AFFINITIES = OPAL_ERR_MULTIPLE_AFFINITIES,
ORTE_ERR_SLOT_LIST_RANGE = OPAL_ERR_SLOT_LIST_RANGE,
ORTE_ERR_SILENT = OPAL_ERR_SILENT,
ORTE_ERR_NOT_INITIALIZED = OPAL_ERR_NOT_INITIALIZED,
ORTE_ERR_NOT_BOUND = OPAL_ERR_NOT_BOUND,
ORTE_ERR_TAKE_NEXT_OPTION = OPAL_ERR_TAKE_NEXT_OPTION,
ORTE_ERR_PROC_ENTRY_NOT_FOUND = OPAL_ERR_PROC_ENTRY_NOT_FOUND,
ORTE_ERR_DATA_VALUE_NOT_FOUND = OPAL_ERR_DATA_VALUE_NOT_FOUND,
/* error codes specific to ORTE - don't forget to update
orte/util/error_strings.c when adding new error codes!!
@ -122,12 +127,8 @@ enum {
ORTE_ERR_NO_EXE_SPECIFIED = (ORTE_ERR_BASE - 39),
ORTE_ERR_COMM_DISABLED = (ORTE_ERR_BASE - 40),
ORTE_ERR_FAILED_TO_MAP = (ORTE_ERR_BASE - 41),
ORTE_ERR_TAKE_NEXT_OPTION = (ORTE_ERR_BASE - 42),
ORTE_ERR_SENSOR_LIMIT_EXCEEDED = (ORTE_ERR_BASE - 43),
ORTE_ERR_JOB_ENTRY_NOT_FOUND = (ORTE_ERR_BASE - 44),
ORTE_ERR_PROC_ENTRY_NOT_FOUND = (ORTE_ERR_BASE - 45),
ORTE_ERR_DATA_VALUE_NOT_FOUND = (ORTE_ERR_BASE - 46),
ORTE_ERR_ALLOCATION_PENDING = (ORTE_ERR_BASE - 47)
ORTE_ERR_SENSOR_LIMIT_EXCEEDED = (ORTE_ERR_BASE - 42),
ORTE_ERR_ALLOCATION_PENDING = (ORTE_ERR_BASE - 44)
};
#define ORTE_ERR_MAX (ORTE_ERR_BASE - 100)

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

@ -1,43 +0,0 @@
/*
* Copyright (c) 2010 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2012 Los Alamos National Security, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "orte_config.h"
#include "orte/constants.h"
#include <stdio.h>
#include "opal/mca/mca.h"
#include "opal/util/output.h"
#include "opal/mca/base/base.h"
#include "opal/mca/base/mca_base_component_repository.h"
#include "orte/mca/db/base/base.h"
extern opal_list_t orte_db_base_components_available;
int
orte_db_base_close(void)
{
if (NULL != orte_db.finalize) {
orte_db.finalize();
}
mca_base_components_close(orte_db_base.output,
&orte_db_base.available_components, NULL);
OBJ_DESTRUCT(&orte_db_base.available_components);
/* Close the framework output */
opal_output_close (orte_db_base.output);
orte_db_base.output = -1;
return ORTE_SUCCESS;
}

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

@ -1,64 +0,0 @@
/*
* Copyright (c) 2010 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2012 Los Alamos National Security, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "orte_config.h"
#include "orte/constants.h"
#include "opal/mca/mca.h"
#include "opal/util/output.h"
#include "opal/mca/base/base.h"
#include "opal/dss/dss_types.h"
#include "orte/mca/db/base/base.h"
/*
* The following file was created by configure. It contains extern
* dbments and the definition of an array of pointers to each
* module's public mca_base_module_t struct.
*/
#include "orte/mca/db/base/static-components.h"
orte_db_base_module_t orte_db = {
NULL,
NULL,
orte_db_base_store,
orte_db_base_store_pointer,
orte_db_base_fetch,
orte_db_base_fetch_pointer,
orte_db_base_fetch_multiple,
orte_db_base_remove_data,
orte_db_base_add_log
};
orte_db_base_t orte_db_base;
int orte_db_base_open(void)
{
orte_db_base.output = opal_output_open(NULL);
OBJ_CONSTRUCT(&orte_db_base.available_components, opal_list_t);
OBJ_CONSTRUCT(&orte_db_base.active_modules, opal_list_t);
/* Open up all available components */
if (ORTE_SUCCESS !=
mca_base_components_open("db", orte_db_base.output, mca_db_base_static_components,
&orte_db_base.available_components,
true)) {
return ORTE_ERROR;
}
return ORTE_SUCCESS;
}
OBJ_CLASS_INSTANCE(orte_db_active_module_t,
opal_list_item_t,
NULL, NULL);

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

@ -1,122 +0,0 @@
/*
* Copyright (c) 2010 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2012 Los Alamos National Security, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "orte_config.h"
#include "orte/constants.h"
#include "opal/class/opal_list.h"
#include "opal/mca/mca.h"
#include "opal/mca/base/base.h"
#include "opal/mca/base/mca_base_component_repository.h"
#include "orte/util/name_fns.h"
#include "orte/mca/errmgr/errmgr.h"
#include "orte/mca/db/base/base.h"
static bool selected = false;
int
orte_db_base_select(void)
{
opal_list_item_t *item, *itm2;
mca_base_component_list_item_t *cli = NULL;
mca_base_component_t *component = NULL;
mca_base_module_t *module = NULL;
orte_db_base_module_t *nmodule;
orte_db_active_module_t *newmodule, *mod;
int rc, priority;
bool inserted;
if (selected) {
/* ensure we don't do this twice */
return ORTE_SUCCESS;
}
selected = true;
/* Query all available components and ask if they have a module */
for (item = opal_list_get_first(&orte_db_base.available_components);
opal_list_get_end(&orte_db_base.available_components) != item;
item = opal_list_get_next(item)) {
cli = (mca_base_component_list_item_t *) item;
component = (mca_base_component_t *) cli->cli_component;
opal_output_verbose(5, orte_db_base.output,
"mca:db:select: checking available component %s", component->mca_component_name);
/* If there's no query function, skip it */
if (NULL == component->mca_query_component) {
opal_output_verbose(5, orte_db_base.output,
"mca:db:select: Skipping component [%s]. It does not implement a query function",
component->mca_component_name );
continue;
}
/* Query the component */
opal_output_verbose(5, orte_db_base.output,
"mca:db:select: Querying component [%s]",
component->mca_component_name);
rc = component->mca_query_component(&module, &priority);
/* If no module was returned, then skip component */
if (ORTE_SUCCESS != rc || NULL == module) {
opal_output_verbose(5, orte_db_base.output,
"mca:db:select: Skipping component [%s]. Query failed to return a module",
component->mca_component_name );
continue;
}
nmodule = (orte_db_base_module_t*) module;
/* attempt to initialize the module */
if (NULL != nmodule->init) {
if (ORTE_SUCCESS != (rc = nmodule->init())) {
/* skip the module */
continue;
}
}
/* If we got a module, add to the list of selected modules */
newmodule = OBJ_NEW(orte_db_active_module_t);
newmodule->pri = priority;
newmodule->module = nmodule;
newmodule->component = component;
/* maintain priority order */
inserted = false;
for (itm2 = opal_list_get_first(&orte_db_base.active_modules);
itm2 != opal_list_get_end(&orte_db_base.active_modules);
itm2 = opal_list_get_next(itm2)) {
mod = (orte_db_active_module_t*)itm2;
if (priority > mod->pri) {
opal_list_insert_pos(&orte_db_base.active_modules,
itm2, &newmodule->super);
inserted = true;
break;
}
}
if (!inserted) {
/* must be lowest priority - add to end */
opal_list_append(&orte_db_base.active_modules, &newmodule->super);
}
}
if (4 < opal_output_get_verbosity(orte_db_base.output)) {
opal_output(0, "%s: Final db priorities", ORTE_NAME_PRINT(ORTE_PROC_MY_NAME));
/* show the prioritized list */
for (itm2 = opal_list_get_first(&orte_db_base.active_modules);
itm2 != opal_list_get_end(&orte_db_base.active_modules);
itm2 = opal_list_get_next(itm2)) {
mod = (orte_db_active_module_t*)itm2;
opal_output(0, "\tComponent: %s Priority: %d", mod->component->mca_component_name, mod->pri);
}
}
return ORTE_SUCCESS;;
}

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

@ -1,41 +0,0 @@
/*
* Copyright (c) 2012 Los Alamos National Security, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
/** @file:
*
* The OpenRTE Database Framework
*
*/
#ifndef ORTE_DB_TYPES_H
#define ORTE_DB_TYPES_H
#include "orte_config.h"
#include "orte/types.h"
#include "opal/mca/mca.h"
#include "opal/dss/dss_types.h"
BEGIN_C_DECLS
/* define some common keys used in ORTE */
#define ORTE_DB_HOSTNAME "orte.hostname"
#define ORTE_DB_DAEMON_VPID "orte.daemon.vpid"
#define ORTE_DB_NODERANK "orte.node.rank"
#define ORTE_DB_LOCALRANK "orte.local.rank"
#define ORTE_DB_BIND_LEVEL "orte.bind.level"
#define ORTE_DB_BIND_INDEX "orte.bind.index"
#define ORTE_DB_LOCALITY "orte.locality"
#define ORTE_DB_ARCH "orte.arch"
#define ORTE_DB_NPROCS "orte.nprocs"
#define ORTE_DB_RMLURI "orte.rmluri"
#define ORTE_DB_BIND_BITMAP "orte.bind.bitmap"
END_C_DECLS
#endif

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

@ -1,38 +0,0 @@
#
# Copyright (c) 2012 Los Alamos National Security, Inc. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
sources = \
db_gpdb.h \
db_gpdb_component.c \
db_gpdb.c
# Make the output library in this directory, and name it either
# mca_<type>_<name>.la (for DSO builds) or libmca_<type>_<name>.la
# (for static builds).
if MCA_BUILD_orte_db_gpdb_DSO
component_noinst =
component_install = mca_db_gpdb.la
else
component_noinst = libmca_db_gpdb.la
component_install =
endif
mcacomponentdir = $(pkglibdir)
mcacomponent_LTLIBRARIES = $(component_install)
mca_db_gpdb_la_CPPFLAGS = $(db_gpdb_CPPFLAGS)
mca_db_gpdb_la_SOURCES = $(sources)
mca_db_gpdb_la_LDFLAGS = -module -avoid-version $(db_gpdb_LDFLAGS)
mca_db_gpdb_la_LIBADD = $(db_gpdb_LIBS)
noinst_LTLIBRARIES = $(component_noinst)
libmca_db_gpdb_la_CPPFLAGS = $(db_gpdb_CPPFLAGS)
libmca_db_gpdb_la_SOURCES =$(sources)
libmca_db_gpdb_la_LDFLAGS = -module -avoid-version $(db_gpdb_LDFLAGS)
libmca_db_gpdb_la_LIBADD = $(db_gpdb_LIBS)

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

@ -1,39 +0,0 @@
dnl -*- shell-script -*-
dnl
dnl Copyright (c) 2012 Los Alamos National Security, Inc. All rights reserved.
dnl $COPYRIGHT$
dnl
dnl Additional copyrights may follow
dnl
dnl $HEADER$
dnl
# MCA_db_gpdb_CONFIG([action-if-found], [action-if-not-found])
# -----------------------------------------------------------
AC_DEFUN([MCA_orte_db_gpdb_CONFIG], [
AC_CONFIG_FILES([orte/mca/db/gpdb/Makefile])
AC_ARG_WITH([gpdb],
[AC_HELP_STRING([--with-gpdb],
[Build gpdb support (default: no)])],
[], with_gpdb=no)
# do not build if rte is disabled or support not requested
AS_IF([test "$orte_without_full_support" = 0 -a "$with_gpdb" != "no"],
[AS_IF([test ! -z "$with_gpdb" -a "$with_gpdb" != "yes"],
[orte_check_gpdb_dir="$with_gpdb"])
OMPI_CHECK_PACKAGE([db_gpdb],
[gpdb.h],
[gpdb],
[gpdb_open],
[],
[$orte_check_gpdb_dir],
[],
[$1],
[$2])],
[$2])
AC_SUBST(db_gpdb_CPPFLAGS)
AC_SUBST(db_gpdb_LDFLAGS)
AC_SUBST(db_gpdb_LIBS)
])dnl

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

@ -1,66 +0,0 @@
/*
* Copyright (c) 2012 Los Alamos National Security, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*
*/
#include "orte_config.h"
#include "orte/constants.h"
#include <string.h>
#include <sys/types.h>
#ifdef HAVE_LIMITS_H
#include <limits.h>
#endif
#include <stdio.h>
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include "orte/mca/db/base/base.h"
#include "db_gpdb.h"
static int init(void);
static void finalize(void);
static int add_log(const char *table,
const opal_value_t *kvs, int nkvs);
orte_db_base_module_t orte_db_gpdb_module = {
init,
finalize,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
add_log
};
/* local variables */
static int init(void)
{
return ORTE_SUCCESS;
}
static void finalize(void)
{
}
static int add_log(const char *table,
const opal_value_t *kvs, int nkvs)
{
opal_output_verbose(2, orte_db_base.output,
"%s Logging data for table %s",
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), table);
return ORTE_ERR_NOT_IMPLEMENTED;
}

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

@ -1,28 +0,0 @@
/*
* Copyright (c) 2012 Los Alamos National Security, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#ifndef ORTE_DB_GPDB_H
#define ORTE_DB_GPDB_H
#include "orte/mca/db/db.h"
BEGIN_C_DECLS
typedef struct {
orte_db_base_component_t super;
int num_worker_threads;
char *db_file;
} orte_db_gpdb_component_t;
ORTE_MODULE_DECLSPEC extern orte_db_gpdb_component_t mca_db_gpdb_component;
ORTE_DECLSPEC extern orte_db_base_module_t orte_db_gpdb_module;
END_C_DECLS
#endif /* ORTE_DB_GPDB_H */

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

@ -1,102 +0,0 @@
/*
* Copyright (c) 2012 Los Alamos National Security, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*
* These symbols are in a file by themselves to provide nice linker
* semantics. Since linkers generally pull in symbols by object
* files, keeping these symbols as the only symbols in this file
* prevents utility programs such as "ompi_info" from having to import
* entire components just to query their version and parameters.
*/
#include "orte_config.h"
#include "orte/constants.h"
#include "opal/mca/base/base.h"
#include "opal/mca/base/mca_base_param.h"
#include "orte/util/proc_info.h"
#include "orte/mca/db/db.h"
#include "orte/mca/db/base/base.h"
#include "db_gpdb.h"
extern orte_db_base_module_t orte_db_gpdb_module;
char *orte_db_gpdb_file;
static int gpdb_component_open(void);
static int gpdb_component_close(void);
static int gpdb_component_query(mca_base_module_t **module, int *priority);
/*
* Instantiate the public struct with all of our public information
* and pointers to our public functions in it
*/
orte_db_gpdb_component_t mca_db_gpdb_component = {
{
{
ORTE_DB_BASE_VERSION_1_0_0,
/* Component name and version */
"gpdb",
ORTE_MAJOR_VERSION,
ORTE_MINOR_VERSION,
ORTE_RELEASE_VERSION,
/* Component open and close functions */
gpdb_component_open,
gpdb_component_close,
gpdb_component_query
},
{
/* The component is checkpoint ready */
MCA_BASE_METADATA_PARAM_CHECKPOINT
}
}
};
static int gpdb_component_open(void)
{
return ORTE_SUCCESS;
}
static int gpdb_component_query(mca_base_module_t **module, int *priority)
{
mca_base_component_t *c = &mca_db_gpdb_component.super.base_version;
/* retrieve the name of the database to be used */
mca_base_param_reg_string(c, "database",
"Name of database",
false, false, NULL, &mca_db_gpdb_component.db_file);
/* retrieve the number of worker threads to be used */
mca_base_param_reg_int(c, "num_worker_threads",
"Number of worker threads to be used",
false, false, 0, &mca_db_gpdb_component.num_worker_threads);
if (NULL != mca_db_gpdb_component.db_file) {
*priority = 3; /* ahead of sqlite3 */
*module = (mca_base_module_t*)&orte_db_gpdb_module;
return ORTE_SUCCESS;
}
*priority = 0;
*module = NULL;
return ORTE_ERROR;
}
static int gpdb_component_close(void)
{
if (NULL != mca_db_gpdb_component.db_file) {
free(mca_db_gpdb_component.db_file);
}
return ORTE_SUCCESS;
}

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

@ -1,21 +0,0 @@
# -*- shell-script -*-
#
# Copyright (c) 2010 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2012 Los Alamos National Security, Inc. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
# MCA_db_hash_CONFIG([action-if-found], [action-if-not-found])
# -----------------------------------------------------------
AC_DEFUN([MCA_orte_db_hash_CONFIG], [
AC_CONFIG_FILES([orte/mca/db/hash/Makefile])
# do not build if rte is disabled
AS_IF([test "$orte_without_full_support" = 0],
[$1],
[$2])
])dnl

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

@ -1,726 +0,0 @@
/*
* Copyright (c) 2010 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2004-2011 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2011-2012 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*
*/
#include "orte_config.h"
#include "orte/constants.h"
#include <time.h>
#include "opal/class/opal_hash_table.h"
#include "opal/class/opal_pointer_array.h"
#include "opal/dss/dss_types.h"
#include "opal/util/output.h"
#include "orte/util/show_help.h"
#include "orte/util/name_fns.h"
#include "orte/mca/errmgr/errmgr.h"
#include "orte/runtime/orte_globals.h"
#include "orte/runtime/orte_wait.h"
#include "orte/mca/db/base/base.h"
#include "db_hash.h"
static int init(void);
static void finalize(void);
static int store(const orte_process_name_t *proc,
const char *key, const void *object, opal_data_type_t type);
static int store_pointer(const orte_process_name_t *proc,
opal_value_t *kv);
static int fetch(const orte_process_name_t *proc,
const char *key, void **data, opal_data_type_t type);
static int fetch_pointer(const orte_process_name_t *proc,
const char *key,
void **data, opal_data_type_t type);
static int fetch_multiple(const orte_process_name_t *proc,
const char *key,
opal_list_t *kvs);
static int remove_data(const orte_process_name_t *proc, const char *key);
orte_db_base_module_t orte_db_hash_module = {
init,
finalize,
store,
store_pointer,
fetch,
fetch_pointer,
fetch_multiple,
remove_data,
NULL
};
/* Local "globals" */
static opal_pointer_array_t job_data;
/**
* Data for a particular orte process
* The name association is maintained in the
* proc_data hash table.
*/
typedef struct {
/** Structure can be put on lists (including in hash tables) */
opal_list_item_t super;
/* List of local_data_t structures containing all data
received from this process, sorted by key. */
opal_list_t data;
} proc_data_t;
static void proc_data_construct(proc_data_t *ptr)
{
OBJ_CONSTRUCT(&ptr->data, opal_list_t);
}
static void proc_data_destruct(proc_data_t *ptr)
{
opal_list_item_t *item;
while (NULL != (item = opal_list_remove_first(&ptr->data))) {
OBJ_RELEASE(item);
}
OBJ_DESTRUCT(&ptr->data);
}
OBJ_CLASS_INSTANCE(proc_data_t, opal_list_item_t,
proc_data_construct, proc_data_destruct);
/* Data for a given job
*/
typedef struct {
opal_object_t super;
orte_jobid_t jobid;
opal_hash_table_t *data;
} job_data_t;
static void jobdata_constructor(job_data_t *ptr)
{
ptr->jobid = ORTE_JOBID_INVALID;
ptr->data = OBJ_NEW(opal_hash_table_t);
opal_hash_table_init(ptr->data, 256);
}
static void jobdata_destructor(job_data_t *ptr)
{
opal_hash_table_remove_all(ptr->data);
OBJ_RELEASE(ptr->data);
}
OBJ_CLASS_INSTANCE(job_data_t,
opal_object_t,
jobdata_constructor,
jobdata_destructor);
static int init(void)
{
OBJ_CONSTRUCT(&job_data, opal_pointer_array_t);
opal_pointer_array_init(&job_data, 1, INT_MAX, 1);
return ORTE_SUCCESS;
}
static void finalize(void)
{
int i;
job_data_t *jtable;
for (i=0; i < job_data.size; i++) {
if (NULL == (jtable = (job_data_t*)opal_pointer_array_get_item(&job_data, i))) {
continue;
}
OBJ_RELEASE(jtable);
}
OBJ_DESTRUCT(&job_data);
}
/**
* Find data for a given key in a given proc_data_t
* container.
*/
static opal_value_t* lookup_keyval(proc_data_t *proc_data,
const char *key)
{
opal_value_t *kv = NULL;
for (kv = (opal_value_t *) opal_list_get_first(&proc_data->data);
kv != (opal_value_t *) opal_list_get_end(&proc_data->data);
kv = (opal_value_t *) opal_list_get_next(kv)) {
if (0 == strcmp(key, kv->key)) {
return kv;
}
}
return NULL;
}
/**
* Find proc_data_t container associated with given
* orte_process_name_t.
*/
static proc_data_t* lookup_orte_proc(opal_hash_table_t *jtable, orte_vpid_t vpid)
{
proc_data_t *proc_data = NULL;
opal_hash_table_get_value_uint32(jtable, orte_util_hash_vpid(vpid), (void**)&proc_data);
if (NULL == proc_data) {
/* The proc clearly exists, so create a data structure for it */
proc_data = OBJ_NEW(proc_data_t);
if (NULL == proc_data) {
opal_output(0, "db:hash:lookup_orte_proc: unable to allocate proc_data_t\n");
return NULL;
}
opal_hash_table_set_value_uint32(jtable, orte_util_hash_vpid(vpid), proc_data);
}
return proc_data;
}
static int store(const orte_process_name_t *proc,
const char *key, const void *data, opal_data_type_t type)
{
int i;
job_data_t *jtable, *jtab;
proc_data_t *proc_data;
opal_value_t *kv;
opal_byte_object_t *boptr;
/* get the job data object for this proc */
jtable = NULL;
for (i=0; i < job_data.size; i++) {
if (NULL == (jtab = (job_data_t*)opal_pointer_array_get_item(&job_data, i))) {
continue;
}
if (jtab->jobid == proc->jobid) {
jtable = jtab;
break;
}
}
if (NULL == jtable) {
/* need to add an entry for this job */
jtable = OBJ_NEW(job_data_t);
jtable->jobid = proc->jobid;
opal_pointer_array_add(&job_data, jtable);
}
/* lookup the proc data object for this proc */
if (NULL == (proc_data = lookup_orte_proc(jtable->data, proc->vpid))) {
/* unrecoverable error */
OPAL_OUTPUT_VERBOSE((5, orte_db_base.output,
"%s db:hash:store: storing key %s[%s] for proc %s unrecoverably failed",
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
key, opal_dss.lookup_data_type(type), ORTE_NAME_PRINT(proc)));
return ORTE_ERR_OUT_OF_RESOURCE;
}
/* see if we already have this key in the data - means we are updating
* a pre-existing value
*/
kv = lookup_keyval(proc_data, key);
OPAL_OUTPUT_VERBOSE((5, orte_db_base.output,
"%s db:hash:store: %s key %s[%s] for proc %s",
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
(NULL == kv ? "storing" : "updating"),
key, opal_dss.lookup_data_type(type), ORTE_NAME_PRINT(proc)));
if (NULL != kv) {
opal_list_remove_item(&proc_data->data, &kv->super);
OBJ_RELEASE(kv);
}
kv = OBJ_NEW(opal_value_t);
kv->key = strdup(key);
opal_list_append(&proc_data->data, &kv->super);
/* the type could come in as an ORTE one (e.g., ORTE_VPID). Since
* the value is an OPAL definition, it cannot cover ORTE data
* types, so convert to the underlying OPAL type
*/
switch (type) {
case OPAL_STRING:
kv->type = OPAL_STRING;
if (NULL != data) {
kv->data.string = strdup( (const char *) data);
} else {
kv->data.string = NULL;
}
break;
case ORTE_VPID:
case OPAL_UINT32:
if (NULL == data) {
ORTE_ERROR_LOG(ORTE_ERR_BAD_PARAM);
return ORTE_ERR_BAD_PARAM;
}
kv->type = OPAL_UINT32;
kv->data.uint32 = *(uint32_t*)data;
break;
case OPAL_UINT16:
if (NULL == data) {
ORTE_ERROR_LOG(ORTE_ERR_BAD_PARAM);
return ORTE_ERR_BAD_PARAM;
}
kv->type = OPAL_UINT16;
kv->data.uint16 = *(uint16_t*)(data);
break;
case OPAL_INT:
if (NULL == data) {
ORTE_ERROR_LOG(ORTE_ERR_BAD_PARAM);
return ORTE_ERR_BAD_PARAM;
}
kv->type = OPAL_INT;
kv->data.integer = *(int*)(data);
break;
case OPAL_UINT:
if (NULL == data) {
ORTE_ERROR_LOG(ORTE_ERR_BAD_PARAM);
return ORTE_ERR_BAD_PARAM;
}
kv->type = OPAL_UINT;
kv->data.uint = *(unsigned int*)(data);
break;
case OPAL_BYTE_OBJECT:
kv->type = OPAL_BYTE_OBJECT;
boptr = (opal_byte_object_t*)data;
if (NULL != boptr && NULL != boptr->bytes && 0 < boptr->size) {
kv->data.bo.bytes = (uint8_t *) malloc(boptr->size);
memcpy(kv->data.bo.bytes, boptr->bytes, boptr->size);
kv->data.bo.size = boptr->size;
} else {
kv->data.bo.bytes = NULL;
kv->data.bo.size = 0;
}
break;
default:
ORTE_ERROR_LOG(ORTE_ERR_NOT_SUPPORTED);
return ORTE_ERR_NOT_SUPPORTED;
}
return ORTE_SUCCESS;
}
static int store_pointer(const orte_process_name_t *proc,
opal_value_t *kv)
{
int i;
job_data_t *jtable, *jtab;
proc_data_t *proc_data;
opal_value_t *k2;
/* get the job data object for this proc */
jtable = NULL;
for (i=0; i < job_data.size; i++) {
if (NULL == (jtab = (job_data_t*)opal_pointer_array_get_item(&job_data, i))) {
continue;
}
if (jtab->jobid == proc->jobid) {
jtable = jtab;
break;
}
}
if (NULL == jtable) {
/* need to add an entry for this job */
jtable = OBJ_NEW(job_data_t);
jtable->jobid = proc->jobid;
opal_pointer_array_add(&job_data, jtable);
}
/* lookup the proc data object for this proc */
if (NULL == (proc_data = lookup_orte_proc(jtable->data, proc->vpid))) {
/* unrecoverable error */
OPAL_OUTPUT_VERBOSE((5, orte_db_base.output,
"%s db:hash:store: storing key %s[%s] for proc %s unrecoverably failed",
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
kv->key, opal_dss.lookup_data_type(kv->type), ORTE_NAME_PRINT(proc)));
return ORTE_ERR_OUT_OF_RESOURCE;
}
/* see if we already have this key in the data - means we are updating
* a pre-existing value
*/
k2 = lookup_keyval(proc_data, kv->key);
OPAL_OUTPUT_VERBOSE((5, orte_db_base.output,
"%s db:hash:store: %s pointer of key %s[%s] for proc %s",
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
(NULL == k2 ? "storing" : "updating"),
kv->key, opal_dss.lookup_data_type(kv->type), ORTE_NAME_PRINT(proc)));
if (NULL != k2) {
opal_list_remove_item(&proc_data->data, &k2->super);
OBJ_RELEASE(k2);
}
opal_list_append(&proc_data->data, &kv->super);
return ORTE_SUCCESS;
}
static int fetch(const orte_process_name_t *proc,
const char *key, void **data, opal_data_type_t type)
{
int i;
job_data_t *jtable, *jtab;
proc_data_t *proc_data;
opal_value_t *kv;
opal_byte_object_t *boptr;
OPAL_OUTPUT_VERBOSE((5, orte_db_base.output,
"%s db:hash:fetch: searching for key %s[%s] on proc %s",
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
(NULL == key) ? "NULL" : key,
opal_dss.lookup_data_type(type),
ORTE_NAME_PRINT(proc)));
/* if the key is NULL, that is an error */
if (NULL == key) {
ORTE_ERROR_LOG(ORTE_ERR_BAD_PARAM);
return ORTE_ERR_BAD_PARAM;
}
/* get the job data object for this proc */
jtable = NULL;
for (i=0; i < job_data.size; i++) {
if (NULL == (jtab = (job_data_t*)opal_pointer_array_get_item(&job_data, i))) {
continue;
}
if (jtab->jobid == proc->jobid) {
jtable = jtab;
break;
}
}
if (NULL == jtable) {
/* eventually, we will fetch this data - but for now, this
* is simply an error
*/
return ORTE_ERR_JOB_ENTRY_NOT_FOUND;
}
/* lookup the proc data object for this proc */
if (NULL == (proc_data = lookup_orte_proc(jtable->data, proc->vpid))) {
/* unrecoverable error */
return ORTE_ERR_PROC_ENTRY_NOT_FOUND;
}
/* find the value */
if (NULL == (kv = lookup_keyval(proc_data, key))) {
/* again, we eventually will attempt to fetch the data - for
* now, just report it as an error */
return ORTE_ERR_DATA_VALUE_NOT_FOUND;
}
/* do the copy and check the type */
switch (type) {
case OPAL_STRING:
if (OPAL_STRING != kv->type) {
return ORTE_ERR_TYPE_MISMATCH;
}
if (NULL != kv->data.string) {
*data = strdup(kv->data.string);
} else {
*data = NULL;
}
break;
case ORTE_VPID:
case OPAL_UINT32:
if (OPAL_UINT32 != kv->type &&
ORTE_VPID != kv->type) {
return ORTE_ERR_TYPE_MISMATCH;
}
memcpy(*data, &kv->data.uint32, 4);
break;
case OPAL_UINT16:
if (OPAL_UINT16 != kv->type &&
ORTE_NODE_RANK != kv->type &&
ORTE_LOCAL_RANK != kv->type) {
return ORTE_ERR_TYPE_MISMATCH;
}
memcpy(*data, &kv->data.uint16, 2);
break;
case OPAL_INT:
if (OPAL_INT != kv->type) {
return ORTE_ERR_TYPE_MISMATCH;
}
memcpy(*data, &kv->data.integer, sizeof(int));
break;
case OPAL_UINT:
if (OPAL_UINT != kv->type) {
return ORTE_ERR_TYPE_MISMATCH;
}
memcpy(*data, &kv->data.uint, sizeof(unsigned int));
break;
case OPAL_BYTE_OBJECT:
if (OPAL_BYTE_OBJECT != kv->type) {
return ORTE_ERR_TYPE_MISMATCH;
}
boptr = (opal_byte_object_t*)malloc(sizeof(opal_byte_object_t));
if (NULL != kv->data.bo.bytes && 0 < kv->data.bo.size) {
boptr->bytes = (uint8_t *) malloc(kv->data.bo.size);
memcpy(boptr->bytes, kv->data.bo.bytes, kv->data.bo.size);
boptr->size = kv->data.bo.size;
} else {
boptr->bytes = NULL;
boptr->size = 0;
}
*data = boptr;
break;
default:
ORTE_ERROR_LOG(ORTE_ERR_NOT_SUPPORTED);
return ORTE_ERR_NOT_SUPPORTED;
}
return ORTE_SUCCESS;
}
static int fetch_pointer(const orte_process_name_t *proc,
const char *key,
void **data, opal_data_type_t type)
{
int i;
job_data_t *jtable, *jtab;
proc_data_t *proc_data;
opal_value_t *kv;
OPAL_OUTPUT_VERBOSE((5, orte_db_base.output,
"%s db:hash:fetch_pointer: searching for key %s on proc %s",
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
(NULL == key) ? "NULL" : key, ORTE_NAME_PRINT(proc)));
/* if the key is NULL, that is an error */
if (NULL == key) {
ORTE_ERROR_LOG(ORTE_ERR_BAD_PARAM);
return ORTE_ERR_BAD_PARAM;
}
/* get the job data object for this proc */
jtable = NULL;
for (i=0; i < job_data.size; i++) {
if (NULL == (jtab = (job_data_t*)opal_pointer_array_get_item(&job_data, i))) {
continue;
}
if (jtab->jobid == proc->jobid) {
jtable = jtab;
break;
}
}
if (NULL == jtable) {
/* eventually, we will fetch this data - but for now, this
* is simply an error
*/
return ORTE_ERR_NOT_FOUND;
}
/* lookup the proc data object for this proc */
if (NULL == (proc_data = lookup_orte_proc(jtable->data, proc->vpid))) {
/* unrecoverable error */
return ORTE_ERR_OUT_OF_RESOURCE;
}
/* find the value */
if (NULL == (kv = lookup_keyval(proc_data, key))) {
/* again, we eventually will attempt to fetch the data - for
* now, just report it as an error */
return ORTE_ERR_NOT_FOUND;
}
switch (type) {
case OPAL_STRING:
if (OPAL_STRING != kv->type) {
return ORTE_ERR_TYPE_MISMATCH;
}
*data = kv->data.string;
break;
case ORTE_VPID:
case OPAL_UINT32:
if (OPAL_UINT32 != kv->type) {
return ORTE_ERR_TYPE_MISMATCH;
}
*data = &kv->data.uint32;
break;
case OPAL_UINT16:
if (OPAL_UINT16 != kv->type) {
return ORTE_ERR_TYPE_MISMATCH;
}
*data = &kv->data.uint16;
break;
case OPAL_INT:
if (OPAL_INT != kv->type) {
return ORTE_ERR_TYPE_MISMATCH;
}
*data = &kv->data.integer;
break;
case OPAL_UINT:
if (OPAL_UINT != kv->type) {
return ORTE_ERR_TYPE_MISMATCH;
}
*data = &kv->data.uint;
break;
case OPAL_BYTE_OBJECT:
if (OPAL_BYTE_OBJECT != kv->type) {
return ORTE_ERR_TYPE_MISMATCH;
}
*data = &kv->data.bo;
break;
default:
ORTE_ERROR_LOG(ORTE_ERR_NOT_SUPPORTED);
return ORTE_ERR_NOT_SUPPORTED;
}
return ORTE_SUCCESS;
}
static int fetch_multiple(const orte_process_name_t *proc,
const char *key,
opal_list_t *kvs)
{
int i;
job_data_t *jtable, *jtab;
proc_data_t *proc_data;
opal_value_t *kv, *kvnew;
int rc;
char *srchkey, *ptr;
size_t len = 0;
OPAL_OUTPUT_VERBOSE((5, orte_db_base.output,
"%s db:hash:fetch_multiple: searching for key %s on proc %s",
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
(NULL == key) ? "NULL" : key, ORTE_NAME_PRINT(proc)));
/* get the job data object for this proc */
jtable = NULL;
for (i=0; i < job_data.size; i++) {
if (NULL == (jtab = (job_data_t*)opal_pointer_array_get_item(&job_data, i))) {
continue;
}
if (jtab->jobid == proc->jobid) {
jtable = jtab;
break;
}
}
if (NULL == jtable) {
/* eventually, we will fetch this data - but for now, this
* is simply an error
*/
return ORTE_ERR_NOT_FOUND;
}
/* lookup the proc data object for this proc */
if (NULL == (proc_data = lookup_orte_proc(jtable->data, proc->vpid))) {
/* unrecoverable error */
return ORTE_ERR_OUT_OF_RESOURCE;
}
/* if the key is NULL, then return all the values */
if (NULL == key) {
for (kv = (opal_value_t*) opal_list_get_first(&proc_data->data);
kv != (opal_value_t*) opal_list_get_end(&proc_data->data);
kv = (opal_value_t*) opal_list_get_next(kv)) {
if (OPAL_SUCCESS != (rc = opal_dss.copy((void**)&kvnew, kv, OPAL_VALUE))) {
ORTE_ERROR_LOG(rc);
return rc;
}
opal_list_append(kvs, &kvnew->super);
}
return ORTE_SUCCESS;
}
/* see if the key includes a wildcard */
srchkey = strdup(key);
if (NULL != (ptr = strchr(srchkey, '*'))) {
*ptr = '\0';
len = strlen(srchkey);
}
/* otherwise, find all matching keys and return them */
for (kv = (opal_value_t*) opal_list_get_first(&proc_data->data);
kv != (opal_value_t*) opal_list_get_end(&proc_data->data);
kv = (opal_value_t*) opal_list_get_next(kv)) {
if ((0 < len && 0 == strncmp(srchkey, kv->key, len)) ||
(0 == len && 0 == strcmp(key, kv->key))) {
if (OPAL_SUCCESS != (rc = opal_dss.copy((void**)&kvnew, kv, OPAL_VALUE))) {
ORTE_ERROR_LOG(rc);
return rc;
}
opal_list_append(kvs, &kvnew->super);
}
}
free(srchkey);
return ORTE_SUCCESS;
}
static int remove_data(const orte_process_name_t *proc, const char *key)
{
int i, save_loc;
job_data_t *jtable, *jtab;
proc_data_t *proc_data;
opal_value_t *kv;
/* if proc is NULL, remove all data from the database */
if (NULL == proc) {
for (i=0; i < job_data.size; i++) {
if (NULL == (jtable = (job_data_t*)opal_pointer_array_get_item(&job_data, i))) {
continue;
}
OBJ_RELEASE(jtable);
}
/* leave the job pointer array itself as we may add data back */
return ORTE_SUCCESS;
}
/* lookup the specified jobid */
jtable = NULL;
for (i=0; i < job_data.size; i++) {
if (NULL == (jtab = (job_data_t*)opal_pointer_array_get_item(&job_data, i))) {
continue;
}
if (jtab->jobid == proc->jobid) {
jtable = jtab;
save_loc = i;
break;
}
}
if (NULL == jtable) {
/* don't have any data for this job */
return ORTE_SUCCESS;
}
/* if vpid is WILDCARD, remove all data for this job */
if (ORTE_VPID_WILDCARD == proc->vpid) {
opal_pointer_array_set_item(&job_data, save_loc, NULL);
OBJ_RELEASE(jtable);
return ORTE_SUCCESS;
}
/* lookup the specified proc */
if (NULL == (proc_data = lookup_orte_proc(jtable->data, proc->vpid))) {
/* no data for this proc */
return ORTE_SUCCESS;
}
/* if key is NULL, remove all data for this proc */
if (NULL == key) {
while (NULL != (kv = (opal_value_t *) opal_list_remove_first(&proc_data->data))) {
OBJ_RELEASE(kv);
}
/* remove the proc_data object itself from the jtable */
opal_hash_table_remove_value_uint32(jtable->data, orte_util_hash_vpid(proc->vpid));
/* cleanup */
OBJ_RELEASE(proc_data);
return ORTE_SUCCESS;
}
/* remove this item */
for (kv = (opal_value_t*) opal_list_get_first(&proc_data->data);
kv != (opal_value_t*) opal_list_get_end(&proc_data->data);
kv = (opal_value_t*) opal_list_get_next(kv)) {
if (0 == strcmp(key, kv->key)) {
OBJ_RELEASE(kv);
break;
}
}
return ORTE_SUCCESS;
}

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

@ -1,76 +0,0 @@
/*
* Copyright (c) 2010 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2012 Los Alamos National Security, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*
* These symbols are in a file by themselves to provide nice linker
* semantics. Since linkers generally pull in symbols by object
* files, keeping these symbols as the only symbols in this file
* prevents utility programs such as "ompi_info" from having to import
* entire components just to query their version and parameters.
*/
#include "orte_config.h"
#include "orte/constants.h"
#include "opal/mca/base/base.h"
#include "orte/mca/db/db.h"
#include "orte/mca/db/base/base.h"
#include "db_hash.h"
static int db_hash_component_open(void);
static int db_hash_component_query(mca_base_module_t **module, int *priority);
static int db_hash_component_close(void);
/*
* Instantiate the public struct with all of our public information
* and pointers to our public functions in it
*/
orte_db_base_component_t mca_db_hash_component = {
{
ORTE_DB_BASE_VERSION_1_0_0,
/* Component name and version */
"hash",
ORTE_MAJOR_VERSION,
ORTE_MINOR_VERSION,
ORTE_RELEASE_VERSION,
/* Component open and close functions */
db_hash_component_open,
db_hash_component_close,
db_hash_component_query
},
{
/* The component is checkpoint ready */
MCA_BASE_METADATA_PARAM_CHECKPOINT
}
};
static int db_hash_component_open(void)
{
return ORTE_SUCCESS;
}
static int db_hash_component_query(mca_base_module_t **module, int *priority)
{
/* we are the default - the ESS modules will set the db selection
* envar if they need someone else
*/
*priority = 50;
*module = (mca_base_module_t*)&orte_db_hash_module;
return ORTE_SUCCESS;
}
static int db_hash_component_close(void)
{
return ORTE_SUCCESS;
}

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

@ -1,23 +0,0 @@
/*
* Copyright (c) 2012 Los Alamos National Security, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#ifndef ORTE_DB_PMI_H
#define ORTE_DB_PMI_H
#include "orte/mca/db/db.h"
BEGIN_C_DECLS
ORTE_MODULE_DECLSPEC extern orte_db_base_component_t mca_db_pmi_component;
ORTE_DECLSPEC extern orte_db_base_module_t orte_db_pmi_module;
END_C_DECLS
#endif /* ORTE_DB_PMI_H */

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

@ -1,85 +0,0 @@
/*
* Copyright (c) 2012 Los Alamos National Security, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*
* These symbols are in a file by themselves to provide nice linker
* semantics. Since linkers generally pull in symbols by object
* files, keeping these symbols as the only symbols in this file
* prevents utility programs such as "ompi_info" from having to import
* entire components just to query their version and parameters.
*/
#include "orte_config.h"
#include "orte/constants.h"
#include "opal/mca/base/base.h"
#include "orte/mca/common/pmi/common_pmi.h"
#include "orte/util/proc_info.h"
#include "orte/mca/db/db.h"
#include "orte/mca/db/base/base.h"
#include "db_pmi.h"
static int db_pmi_component_open(void);
static int db_pmi_component_query(mca_base_module_t **module, int *priority);
static int db_pmi_component_close(void);
/*
* Instantiate the public struct with all of our public information
* and pointers to our public functions in it
*/
orte_db_base_component_t mca_db_pmi_component = {
{
ORTE_DB_BASE_VERSION_1_0_0,
/* Component name and version */
"pmi",
ORTE_MAJOR_VERSION,
ORTE_MINOR_VERSION,
ORTE_RELEASE_VERSION,
/* Component open and close functions */
db_pmi_component_open,
db_pmi_component_close,
db_pmi_component_query
},
{
/* The component is checkpoint ready */
MCA_BASE_METADATA_PARAM_CHECKPOINT
}
};
static int db_pmi_component_open(void)
{
return ORTE_SUCCESS;
}
static int db_pmi_component_query(mca_base_module_t **module, int *priority)
{
/* only use PMI if available - the ESS pmi module
* will force our selection if we are direct-launched
*/
if (mca_common_pmi_init()) {
*priority = 10;
*module = (mca_base_module_t*)&orte_db_pmi_module;
return ORTE_SUCCESS;
}
*priority = 0;
*module = NULL;
return ORTE_ERROR;
}
static int db_pmi_component_close(void)
{
mca_common_pmi_finalize();
return ORTE_SUCCESS;
}

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

@ -1,27 +0,0 @@
/*
* Copyright (c) 2012-2013 Los Alamos National Security, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#ifndef ORTE_DB_PRINT_H
#define ORTE_DB_PRINT_H
#include "orte/mca/db/db.h"
BEGIN_C_DECLS
typedef struct {
orte_db_base_component_t super;
char *filename;
} orte_db_print_component_t;
ORTE_MODULE_DECLSPEC extern orte_db_print_component_t mca_db_print_component;
ORTE_DECLSPEC extern orte_db_base_module_t orte_db_print_module;
END_C_DECLS
#endif /* ORTE_DB_PRINT_H */

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

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012 Los Alamos National Security, LLC.
* Copyright (c) 2012-2013 Los Alamos National Security, LLC.
* All rights reserved.
* $COPYRIGHT$
*
@ -26,12 +26,12 @@
#include "opal/util/output.h"
#include "opal/util/uri.h"
#include "opal/dss/dss.h"
#include "opal/mca/db/db.h"
#include "orte/util/error_strings.h"
#include "orte/util/name_fns.h"
#include "orte/util/show_help.h"
#include "orte/runtime/orte_globals.h"
#include "orte/mca/db/db.h"
#include "orte/mca/errmgr/errmgr.h"
#include "orte/mca/rml/rml.h"
@ -507,6 +507,7 @@ static void process_opens(int fd, short args, void *cbdata)
char *scheme, *host, *filename;
orte_process_name_t daemon;
orte_vpid_t *v;
opal_identifier_t *id;
/* get the scheme to determine if we can process locally or not */
if (NULL == (scheme = opal_uri_get_scheme(dfs->uri))) {
@ -557,7 +558,8 @@ static void process_opens(int fd, short args, void *cbdata)
"%s looking for daemon on host %s",
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), host);
v = &daemon.vpid;
if (ORTE_SUCCESS != (rc = orte_db.fetch(ORTE_NAME_WILDCARD, host, (void**)&v, ORTE_VPID))) {
id = (opal_identifier_t*)ORTE_NAME_WILDCARD;
if (ORTE_SUCCESS != (rc = opal_db.fetch((*id), host, (void**)&v, ORTE_VPID))) {
ORTE_ERROR_LOG(rc);
goto complete;
}

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

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012 Los Alamos National Security, LLC.
* Copyright (c) 2012-2013 Los Alamos National Security, LLC.
* All rights reserved.
* $COPYRIGHT$
*
@ -26,12 +26,12 @@
#include "opal/util/output.h"
#include "opal/util/uri.h"
#include "opal/dss/dss.h"
#include "opal/mca/db/db.h"
#include "orte/util/error_strings.h"
#include "orte/util/name_fns.h"
#include "orte/util/show_help.h"
#include "orte/runtime/orte_globals.h"
#include "orte/mca/db/db.h"
#include "orte/mca/errmgr/errmgr.h"
#include "orte/mca/rml/rml.h"
@ -451,6 +451,7 @@ static void process_opens(int fd, short args, void *cbdata)
orte_process_name_t daemon;
bool found;
orte_vpid_t v;
opal_identifier_t *id;
opal_output(0, "%s PROCESSING OPEN", ORTE_NAME_PRINT(ORTE_PROC_MY_NAME));
/* get the scheme to determine if we can process locally or not */
@ -479,10 +480,11 @@ static void process_opens(int fd, short args, void *cbdata)
/* ident the daemon on that host */
daemon.jobid = ORTE_PROC_MY_DAEMON->jobid;
found = false;
id = (opal_identifier_t*)&daemon;
for (v=0; v < orte_process_info.num_daemons; v++) {
daemon.vpid = v;
/* fetch the hostname where this daemon is located */
if (ORTE_SUCCESS != (rc = orte_db.fetch_pointer(&daemon, ORTE_DB_HOSTNAME, (void**)&hostname, OPAL_STRING))) {
if (ORTE_SUCCESS != (rc = opal_db.fetch_pointer((*id), ORTE_DB_HOSTNAME, (void**)&hostname, OPAL_STRING))) {
ORTE_ERROR_LOG(rc);
goto complete;
}

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

@ -10,7 +10,7 @@
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2010-2012 Oak Ridge National Labs. All rights reserved.
* Copyright (c) 2011-2012 Los Alamos National Security, LLC. All rights
* Copyright (c) 2011-2013 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
@ -32,6 +32,7 @@
#endif
#include "opal/mca/event/event.h"
#include "opal/mca/db/base/base.h"
#include "orte/util/show_help.h"
#include "opal/util/os_path.h"
#include "opal/util/output.h"
@ -41,7 +42,6 @@
#include "orte/mca/rml/base/base.h"
#include "orte/mca/routed/base/base.h"
#include "orte/mca/errmgr/errmgr.h"
#include "orte/mca/db/base/base.h"
#include "orte/mca/dfs/base/base.h"
#include "orte/mca/grpcomm/base/base.h"
#include "orte/mca/rml/rml.h"
@ -142,12 +142,12 @@ int orte_ess_base_app_setup(void)
}
/* database */
if (ORTE_SUCCESS != (ret = orte_db_base_open())) {
if (ORTE_SUCCESS != (ret = opal_db_base_open())) {
ORTE_ERROR_LOG(ret);
error = "orte_db_base_open";
goto error;
}
if (ORTE_SUCCESS != (ret = orte_db_base_select())) {
if (ORTE_SUCCESS != (ret = opal_db_base_select())) {
ORTE_ERROR_LOG(ret);
error = "orte_db_base_select";
goto error;
@ -312,7 +312,7 @@ int orte_ess_base_app_finalize(void)
/* now can close the rml and its friendly group comm */
orte_grpcomm_base_close();
orte_db_base_close();
opal_db_base_close();
orte_routed_base_close();
orte_rml_base_close();

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

@ -12,7 +12,7 @@
* Copyright (c) 2009 Institut National de Recherche en Informatique
* et Automatique. All rights reserved.
* Copyright (c) 2011 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2011-2012 Los Alamos National Security, LLC. All rights
* Copyright (c) 2011-2013 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
@ -37,6 +37,7 @@
#include "opal/mca/event/event.h"
#include "opal/runtime/opal.h"
#include "opal/runtime/opal_cr.h"
#include "opal/mca/db/base/base.h"
#include "opal/mca/hwloc/base/base.h"
#include "opal/mca/pstat/base/base.h"
#include "opal/util/os_path.h"
@ -44,7 +45,6 @@
#include "orte/mca/rml/base/base.h"
#include "orte/mca/routed/base/base.h"
#include "orte/mca/routed/routed.h"
#include "orte/mca/db/base/base.h"
#include "orte/mca/dfs/base/base.h"
#include "orte/mca/grpcomm/grpcomm.h"
#include "orte/mca/grpcomm/base/base.h"
@ -272,12 +272,12 @@ int orte_ess_base_orted_setup(char **hosts)
}
/* database */
if (ORTE_SUCCESS != (ret = orte_db_base_open())) {
if (ORTE_SUCCESS != (ret = opal_db_base_open())) {
ORTE_ERROR_LOG(ret);
error = "orte_db_base_open";
goto error;
}
if (ORTE_SUCCESS != (ret = orte_db_base_select())) {
if (ORTE_SUCCESS != (ret = opal_db_base_select())) {
ORTE_ERROR_LOG(ret);
error = "orte_db_base_select";
goto error;

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

@ -11,7 +11,7 @@
* All rights reserved.
* Copyright (c) 2010-2011 Oak Ridge National Labs. All rights reserved.
* Copyright (c) 2011-2012 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2011-2012 Los Alamos National Security, LLC. All rights
* Copyright (c) 2011-2013 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
@ -34,6 +34,7 @@
#endif
#include "opal/class/opal_list.h"
#include "opal/mca/db/base/base.h"
#include "opal/mca/event/event.h"
#include "opal/runtime/opal.h"
#include "opal/runtime/opal_cr.h"
@ -50,7 +51,6 @@
#include "orte/mca/rml/rml_types.h"
#include "orte/mca/routed/base/base.h"
#include "orte/mca/routed/routed.h"
#include "orte/mca/db/base/base.h"
#include "orte/mca/dfs/base/base.h"
#include "orte/mca/errmgr/base/base.h"
#include "orte/mca/grpcomm/base/base.h"
@ -321,12 +321,12 @@ static int rte_init(void)
}
/* database */
if (ORTE_SUCCESS != (ret = orte_db_base_open())) {
if (ORTE_SUCCESS != (ret = opal_db_base_open())) {
ORTE_ERROR_LOG(ret);
error = "orte_db_base_open";
goto error;
}
if (ORTE_SUCCESS != (ret = orte_db_base_select())) {
if (ORTE_SUCCESS != (ret = opal_db_base_select())) {
ORTE_ERROR_LOG(ret);
error = "orte_db_base_select";
goto error;

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

@ -1,5 +1,7 @@
#
# 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
@ -31,7 +33,7 @@ mcacomponent_LTLIBRARIES = $(component_install)
mca_ess_pmi_la_SOURCES = $(sources)
mca_ess_pmi_la_LDFLAGS = -module -avoid-version $(ess_pmi_LDFLAGS)
mca_ess_pmi_la_LIBADD = $(ess_pmi_LIBS) \
$(top_ompi_builddir)/orte/mca/common/pmi/libmca_common_pmi.la
$(top_ompi_builddir)/opal/mca/common/pmi/libmca_common_pmi.la
noinst_LTLIBRARIES = $(component_noinst)
libmca_ess_pmi_la_SOURCES =$(sources)

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

@ -1,7 +1,7 @@
# -*- shell-script -*-
#
# Copyright (c) 2009-2011 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2011 Los Alamos National Security, LLC.
# Copyright (c) 2011-2013 Los Alamos National Security, LLC.
# All rights reserved.
# $COPYRIGHT$
#
@ -17,7 +17,7 @@ AC_DEFUN([MCA_orte_ess_pmi_CONFIG],[
AC_CONFIG_FILES([orte/mca/ess/pmi/Makefile])
# see if PMI support requested
ORTE_CHECK_PMI([ess_pmi], [ess_pmi_good=1], [ess_pmi_good=0])
OPAL_CHECK_PMI([ess_pmi], [ess_pmi_good=1], [ess_pmi_good=0])
# Evaluate succeed / fail
AS_IF([test "$ess_pmi_good" = "1" -a "$orte_without_full_support" = 0],

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

@ -1,6 +1,6 @@
/*
* Copyright (c) 2011 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2011-2012 Los Alamos National Security, LLC. All
* Copyright (c) 2011-2013 Los Alamos National Security, LLC. All
* rights reserved.
* $COPYRIGHT$
*
@ -23,13 +23,13 @@
#include <pmi2.h>
#endif
#include "opal/mca/common/pmi/common_pmi.h"
#include "orte/util/proc_info.h"
#include "orte/mca/ess/ess.h"
#include "orte/mca/ess/pmi/ess_pmi.h"
#include "orte/mca/common/pmi/common_pmi.h"
extern orte_ess_base_module_t orte_ess_pmi_module;
static int pmi_component_open(void);

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

@ -46,9 +46,9 @@
#include "opal/class/opal_pointer_array.h"
#include "opal/mca/hwloc/base/base.h"
#include "opal/util/printf.h"
#include "opal/mca/common/pmi/common_pmi.h"
#include "orte/mca/common/pmi/common_pmi.h"
#include "orte/mca/db/db.h"
#include "opal/mca/db/db.h"
#include "orte/mca/errmgr/errmgr.h"
#include "orte/mca/rml/rml.h"
#include "orte/util/proc_info.h"
@ -96,6 +96,8 @@ static int rte_init(void)
orte_local_rank_t local_rank;
orte_node_rank_t node_rank;
char *rmluri;
opal_identifier_t *id;
opal_hwloc_locality_t locality;
/* run the prolog */
if (ORTE_SUCCESS != (ret = orte_ess_base_std_prolog())) {
@ -131,7 +133,7 @@ static int rte_init(void)
ORTE_PROC_MY_NAME->jobid = jobid;
/* get our rank from PMI */
if (PMI_SUCCESS != (ret = PMI_Get_rank(&i))) {
ORTE_PMI_ERROR(ret, "PMI_Get_rank");
OPAL_PMI_ERROR(ret, "PMI_Get_rank");
error = "could not get PMI rank";
goto error;
}
@ -139,7 +141,7 @@ static int rte_init(void)
/* get the number of procs from PMI */
if (PMI_SUCCESS != (ret = PMI_Get_universe_size(&i))) {
ORTE_PMI_ERROR(ret, "PMI_Get_universe_size");
OPAL_PMI_ERROR(ret, "PMI_Get_universe_size");
error = "could not get PMI universe size";
goto error;
}
@ -185,7 +187,7 @@ static int rte_init(void)
/* get our rank */
if (PMI_SUCCESS != (ret = PMI_Get_rank(&i))) {
ORTE_PMI_ERROR(ret, "PMI_Get_rank");
OPAL_PMI_ERROR(ret, "PMI_Get_rank");
error = "could not get PMI rank";
goto error;
}
@ -193,7 +195,7 @@ static int rte_init(void)
/* get the number of procs from PMI */
if (PMI_SUCCESS != (ret = PMI_Get_universe_size(&i))) {
ORTE_PMI_ERROR(ret, "PMI_Get_universe_size");
OPAL_PMI_ERROR(ret, "PMI_Get_universe_size");
error = "could not get PMI universe size";
goto error;
}
@ -239,7 +241,7 @@ static int rte_init(void)
/* ensure we pick the correct critical components */
putenv("OMPI_MCA_grpcomm=pmi");
putenv("OMPI_MCA_db=pmi");
putenv("OMPI_MCA_db_pmi_store_priority=100");
putenv("OMPI_MCA_routed=direct");
/* now use the default procedure to finish my setup */
@ -251,7 +253,7 @@ static int rte_init(void)
/* get our local proc info to find our local rank */
if (PMI_SUCCESS != (ret = PMI_Get_clique_size(&i))) {
ORTE_PMI_ERROR(ret, "PMI_Get_clique_size");
OPAL_PMI_ERROR(ret, "PMI_Get_clique_size");
error = "could not get PMI clique size";
goto error;
}
@ -263,7 +265,7 @@ static int rte_init(void)
/* now get the specific ranks */
ranks = (int*)malloc(i * sizeof(int));
if (PMI_SUCCESS != (ret = PMI_Get_clique_ranks(ranks, i))) {
ORTE_PMI_ERROR(ret, "PMI_Get_clique_ranks");
OPAL_PMI_ERROR(ret, "PMI_Get_clique_ranks");
error = "could not get clique ranks";
goto error;
}
@ -300,13 +302,44 @@ static int rte_init(void)
asprintf(&pmirte, "%s,%s,%d,%d,%d,%d", rmluri, orte_process_info.nodename,
(int)orte_process_info.bind_level, (int)orte_process_info.bind_idx,
(int)orte_process_info.my_local_rank, (int)orte_process_info.my_node_rank);
free(rmluri);
/* store our info into the database */
if (ORTE_SUCCESS != (ret = orte_db.store(ORTE_PROC_MY_NAME, "RTE", pmirte, OPAL_STRING))) {
/* push our info into the cloud */
id = (opal_identifier_t*)ORTE_PROC_MY_NAME;
if (ORTE_SUCCESS != (ret = opal_db.store((*id), OPAL_DB_GLOBAL, "RTE", pmirte, OPAL_STRING))) {
error = "db store RTE info";
goto error;
}
free(pmirte);
/* store our info in the internal database */
if (ORTE_SUCCESS != (ret = opal_db.store((*id), OPAL_DB_INTERNAL, ORTE_DB_RMLURI, rmluri, OPAL_STRING))) {
error = "db store uri";
goto error;
}
free(rmluri);
if (ORTE_SUCCESS != (ret = opal_db.store((*id), OPAL_DB_INTERNAL, ORTE_DB_HOSTNAME, orte_process_info.nodename, OPAL_STRING))) {
error = "db store hostname";
goto error;
}
if (ORTE_SUCCESS != (ret = opal_db.store((*id), OPAL_DB_INTERNAL, ORTE_DB_BIND_LEVEL, &orte_process_info.bind_level, OPAL_HWLOC_LEVEL_T))) {
error = "db store bind_level";
goto error;
}
if (ORTE_SUCCESS != (ret = opal_db.store((*id), OPAL_DB_INTERNAL, ORTE_DB_BIND_INDEX, &orte_process_info.bind_idx, OPAL_UINT))) {
error = "db store bind_idx";
goto error;
}
if (ORTE_SUCCESS != (ret = opal_db.store((*id), OPAL_DB_INTERNAL, ORTE_DB_LOCALRANK, &orte_process_info.my_local_rank, ORTE_LOCAL_RANK))) {
error = "db store local rank";
goto error;
}
if (ORTE_SUCCESS != (ret = opal_db.store((*id), OPAL_DB_INTERNAL, ORTE_DB_NODERANK, &orte_process_info.my_node_rank, ORTE_NODE_RANK))) {
error = "db store node rank";
goto error;
}
locality = OPAL_PROC_ALL_LOCAL;
if (ORTE_SUCCESS != (ret = opal_db.store((*id), OPAL_DB_INTERNAL, ORTE_DB_LOCALITY, &locality, OPAL_HWLOC_LOCALITY_T))) {
error = "db store locality";
goto error;
}
/* flag that we completed init */
app_init_complete = true;

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

@ -12,7 +12,7 @@
* All rights reserved.
* Copyright (c) 2007 Sun Microsystems, Inc. All rights reserved.
* Copyright (c) 2011 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2011-2012 Los Alamos National Security, LLC.
* Copyright (c) 2011-2013 Los Alamos National Security, LLC.
* All rights reserved.
* $COPYRIGHT$
*
@ -34,10 +34,10 @@
#include "opal/util/output.h"
#include "opal/class/opal_hash_table.h"
#include "opal/dss/dss.h"
#include "opal/mca/db/db.h"
#include "opal/mca/hwloc/base/base.h"
#include "orte/util/proc_info.h"
#include "orte/mca/db/db.h"
#include "orte/mca/errmgr/errmgr.h"
#include "orte/mca/ess/ess.h"
#include "orte/runtime/orte_globals.h"
@ -224,7 +224,8 @@ void orte_grpcomm_base_modex(int fd, short args, void *cbdata)
void orte_grpcomm_base_store_peer_modex(opal_buffer_t *rbuf, void *cbdata)
{
int rc, cnt;
orte_process_name_t proc_name;
orte_process_name_t pname;
opal_identifier_t *id;
char *hostname;
orte_vpid_t daemon;
orte_node_rank_t node_rank;
@ -238,14 +239,15 @@ void orte_grpcomm_base_store_peer_modex(opal_buffer_t *rbuf, void *cbdata)
/* unpack the process name */
cnt=1;
while (ORTE_SUCCESS == (rc = opal_dss.unpack(rbuf, &proc_name, &cnt, ORTE_NAME))) {
while (ORTE_SUCCESS == (rc = opal_dss.unpack(rbuf, &pname, &cnt, ORTE_NAME))) {
id = (opal_identifier_t*)&pname;
/* unpack and store the hostname */
cnt = 1;
if (ORTE_SUCCESS != (rc = opal_dss.unpack(rbuf, &hostname, &cnt, OPAL_STRING))) {
ORTE_ERROR_LOG(rc);
goto cleanup;
}
if (ORTE_SUCCESS != (rc = orte_db.store(&proc_name, ORTE_DB_HOSTNAME, hostname, OPAL_STRING))) {
if (ORTE_SUCCESS != (rc = opal_db.store((*id), OPAL_DB_INTERNAL, ORTE_DB_HOSTNAME, hostname, OPAL_STRING))) {
ORTE_ERROR_LOG(rc);
goto cleanup;
}
@ -256,7 +258,7 @@ void orte_grpcomm_base_store_peer_modex(opal_buffer_t *rbuf, void *cbdata)
ORTE_ERROR_LOG(rc);
goto cleanup;
}
if (ORTE_SUCCESS != (rc = orte_db.store(&proc_name, ORTE_DB_DAEMON_VPID, &daemon, ORTE_VPID))) {
if (ORTE_SUCCESS != (rc = opal_db.store((*id), OPAL_DB_INTERNAL, ORTE_DB_DAEMON_VPID, &daemon, OPAL_UINT32))) {
ORTE_ERROR_LOG(rc);
goto cleanup;
}
@ -267,7 +269,7 @@ void orte_grpcomm_base_store_peer_modex(opal_buffer_t *rbuf, void *cbdata)
ORTE_ERROR_LOG(rc);
goto cleanup;
}
if (ORTE_SUCCESS != (rc = orte_db.store(&proc_name, ORTE_DB_NODERANK, &node_rank, ORTE_NODE_RANK))) {
if (ORTE_SUCCESS != (rc = opal_db.store((*id), OPAL_DB_INTERNAL, ORTE_DB_NODERANK, &node_rank, ORTE_NODE_RANK))) {
ORTE_ERROR_LOG(rc);
goto cleanup;
}
@ -278,7 +280,7 @@ void orte_grpcomm_base_store_peer_modex(opal_buffer_t *rbuf, void *cbdata)
ORTE_ERROR_LOG(rc);
goto cleanup;
}
if (ORTE_SUCCESS != (rc = orte_db.store(&proc_name, ORTE_DB_LOCALRANK, &local_rank, ORTE_LOCAL_RANK))) {
if (ORTE_SUCCESS != (rc = opal_db.store((*id), OPAL_DB_INTERNAL, ORTE_DB_LOCALRANK, &local_rank, ORTE_LOCAL_RANK))) {
ORTE_ERROR_LOG(rc);
goto cleanup;
}
@ -295,7 +297,7 @@ void orte_grpcomm_base_store_peer_modex(opal_buffer_t *rbuf, void *cbdata)
ORTE_ERROR_LOG(rc);
goto cleanup;
}
if (ORTE_SUCCESS != (rc = orte_db.store(&proc_name, ORTE_DB_BIND_LEVEL, &bind_level, OPAL_HWLOC_LEVEL_T))) {
if (ORTE_SUCCESS != (rc = opal_db.store((*id), OPAL_DB_INTERNAL, ORTE_DB_BIND_LEVEL, &bind_level, OPAL_HWLOC_LEVEL_T))) {
ORTE_ERROR_LOG(rc);
goto cleanup;
}
@ -304,29 +306,29 @@ void orte_grpcomm_base_store_peer_modex(opal_buffer_t *rbuf, void *cbdata)
ORTE_ERROR_LOG(rc);
goto cleanup;
}
if (ORTE_SUCCESS != (rc = orte_db.store(&proc_name, ORTE_DB_BIND_INDEX, &bind_idx, OPAL_UINT))) {
if (ORTE_SUCCESS != (rc = opal_db.store((*id), OPAL_DB_INTERNAL, ORTE_DB_BIND_INDEX, &bind_idx, OPAL_UINT))) {
ORTE_ERROR_LOG(rc);
goto cleanup;
}
OPAL_OUTPUT_VERBOSE((2, orte_grpcomm_base.output,
"%s store:peer:modex setting proc %s level %s idx %u",
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
ORTE_NAME_PRINT(&proc_name),
ORTE_NAME_PRINT(&pname),
opal_hwloc_base_print_level(bind_level), bind_idx));
if (OPAL_EQUAL == orte_util_compare_name_fields(ORTE_NS_CMP_ALL, &proc_name, ORTE_PROC_MY_NAME)) {
if (OPAL_EQUAL == orte_util_compare_name_fields(ORTE_NS_CMP_ALL, &pname, ORTE_PROC_MY_NAME)) {
/* if this data is from myself, then set locality to all */
OPAL_OUTPUT_VERBOSE((5, orte_grpcomm_base.output,
"%s store:peer:modex setting proc %s locale ALL",
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
ORTE_NAME_PRINT(&proc_name)));
ORTE_NAME_PRINT(&pname)));
locality = OPAL_PROC_ALL_LOCAL;
} else if (daemon != ORTE_PROC_MY_DAEMON->vpid) {
/* this is on a different node, then mark as non-local */
OPAL_OUTPUT_VERBOSE((5, orte_grpcomm_base.output,
"%s store:peer:modex setting proc %s locale NONLOCAL",
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
ORTE_NAME_PRINT(&proc_name)));
ORTE_NAME_PRINT(&pname)));
locality = OPAL_PROC_NON_LOCAL;
} else if (OPAL_HWLOC_NODE_LEVEL == orte_process_info.bind_level ||
OPAL_HWLOC_NODE_LEVEL == bind_level) {
@ -343,31 +345,31 @@ void orte_grpcomm_base_store_peer_modex(opal_buffer_t *rbuf, void *cbdata)
OPAL_OUTPUT_VERBOSE((5, orte_grpcomm_base.output,
"%s store:peer:modex setting proc %s locale %s",
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
ORTE_NAME_PRINT(&proc_name),
ORTE_NAME_PRINT(&pname),
opal_hwloc_base_print_locality(locality)));
}
}
#else
if (OPAL_EQUAL == orte_util_compare_name_fields(ORTE_NS_CMP_ALL, &proc_name, ORTE_PROC_MY_NAME)) {
if (OPAL_EQUAL == orte_util_compare_name_fields(ORTE_NS_CMP_ALL, &pname, ORTE_PROC_MY_NAME)) {
/* if this data is from myself, then set locality to all */
OPAL_OUTPUT_VERBOSE((5, orte_grpcomm_base.output,
"%s grpcomm:base:modex setting proc %s locale ALL",
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
ORTE_NAME_PRINT(&proc_name)));
ORTE_NAME_PRINT(&pname)));
locality = OPAL_PROC_ALL_LOCAL;
} else if (daemon != ORTE_PROC_MY_DAEMON->vpid) {
/* this is on a different node, then mark as non-local */
OPAL_OUTPUT_VERBOSE((5, orte_grpcomm_base.output,
"%s store:peer:modex setting proc %s locale NONLOCAL",
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
ORTE_NAME_PRINT(&proc_name)));
ORTE_NAME_PRINT(&pname)));
locality = OPAL_PROC_NON_LOCAL;
} else {
/* must be on our node */
locality = OPAL_PROC_ON_NODE;
}
#endif
if (ORTE_SUCCESS != (rc = orte_db.store(&proc_name, ORTE_DB_LOCALITY, &locality, OPAL_HWLOC_LOCALITY_T))) {
if (ORTE_SUCCESS != (rc = opal_db.store((*id), OPAL_DB_INTERNAL, ORTE_DB_LOCALITY, &locality, OPAL_HWLOC_LOCALITY_T))) {
ORTE_ERROR_LOG(rc);
goto cleanup;
}
@ -375,17 +377,17 @@ void orte_grpcomm_base_store_peer_modex(opal_buffer_t *rbuf, void *cbdata)
OPAL_OUTPUT_VERBOSE((5, orte_grpcomm_base.output,
"%s store:peer:modex: adding modex entry for proc %s",
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
ORTE_NAME_PRINT(&proc_name)));
ORTE_NAME_PRINT(&pname)));
/* update the modex database */
if (ORTE_SUCCESS != (rc = orte_grpcomm_base_update_modex_entries(&proc_name, rbuf))) {
if (ORTE_SUCCESS != (rc = orte_grpcomm_base_update_modex_entries(&pname, rbuf))) {
ORTE_ERROR_LOG(rc);
goto cleanup;
}
OPAL_OUTPUT_VERBOSE((5, orte_grpcomm_base.output,
"%s store:peer:modex: completed modex entry for proc %s",
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
ORTE_NAME_PRINT(&proc_name)));
ORTE_NAME_PRINT(&pname)));
}
cleanup:
@ -461,6 +463,7 @@ int orte_grpcomm_base_update_modex_entries(orte_process_name_t *proc_name,
int32_t num_recvd_entries;
orte_std_cntr_t cnt;
orte_std_cntr_t j;
opal_identifier_t *id;
/* unpack the number of entries for this proc */
cnt=1;
@ -474,6 +477,8 @@ int orte_grpcomm_base_update_modex_entries(orte_process_name_t *proc_name,
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), num_recvd_entries,
ORTE_NAME_PRINT(proc_name)));
id = (opal_identifier_t*)proc_name;
/*
* Extract the attribute names and values
*/
@ -490,7 +495,7 @@ int orte_grpcomm_base_update_modex_entries(orte_process_name_t *proc_name,
OBJ_RELEASE(kv);
} else {
/* store it in the database */
if (ORTE_SUCCESS != (rc = orte_db.store_pointer(proc_name, kv))) {
if (ORTE_SUCCESS != (rc = opal_db.store_pointer((*id), OPAL_DB_INTERNAL, kv))) {
ORTE_ERROR_LOG(rc);
goto cleanup;
}
@ -509,10 +514,12 @@ int orte_grpcomm_base_pack_modex_entries(opal_buffer_t *buf)
opal_value_t *kv;
opal_list_t data;
opal_list_item_t *item, *next;
opal_identifier_t *id;
/* fetch our data */
OBJ_CONSTRUCT(&data, opal_list_t);
if (ORTE_SUCCESS != (rc = orte_db.fetch_multiple(ORTE_PROC_MY_NAME, NULL, &data))) {
id = (opal_identifier_t*)ORTE_PROC_MY_NAME;
if (ORTE_SUCCESS != (rc = opal_db.fetch_multiple((*id), NULL, &data))) {
ORTE_ERROR_LOG(rc);
goto cleanup;
}

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

@ -1,5 +1,7 @@
#
# 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
@ -31,7 +33,7 @@ mcacomponent_LTLIBRARIES = $(component_install)
mca_grpcomm_pmi_la_SOURCES = $(sources)
mca_grpcomm_pmi_la_LDFLAGS = -module -avoid-version $(grpcomm_pmi_LDFLAGS)
mca_grpcomm_pmi_la_LIBADD = $(grpcomm_pmi_LIBS) \
$(top_ompi_builddir)/orte/mca/common/pmi/libmca_common_pmi.la
$(top_ompi_builddir)/opal/mca/common/pmi/libmca_common_pmi.la
noinst_LTLIBRARIES = $(component_noinst)
libmca_grpcomm_pmi_la_SOURCES =$(sources)

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

@ -1,7 +1,7 @@
# -*- shell-script -*-
#
# Copyright (c) 2011 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2011 Los Alamos National Security, LLC.
# Copyright (c) 2011-2013 Los Alamos National Security, LLC.
# All rights reserved.
# $COPYRIGHT$
#
@ -16,7 +16,7 @@ AC_DEFUN([MCA_orte_grpcomm_pmi_PRIORITY], [10])
AC_DEFUN([MCA_orte_grpcomm_pmi_CONFIG], [
AC_CONFIG_FILES([orte/mca/grpcomm/pmi/Makefile])
ORTE_CHECK_PMI([grpcomm_pmi], [grpcomm_pmi_good=1], [grpcomm_pmi_good=0])
OPAL_CHECK_PMI([grpcomm_pmi], [grpcomm_pmi_good=1], [grpcomm_pmi_good=0])
# Evaluate succeed / fail
AS_IF([test "$grpcomm_pmi_good" = 1 -a "$orte_without_full_support" = 0],

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

@ -1,7 +1,7 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2011 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2011-2012 Los Alamos National Security, LLC. All
* Copyright (c) 2011-2013 Los Alamos National Security, LLC. All
* rights reserved.
* $COPYRIGHT$
*
@ -20,9 +20,9 @@
#include "opal/mca/mca.h"
#include "opal/mca/base/mca_base_param.h"
#include "opal/mca/common/pmi/common_pmi.h"
#include "orte/util/proc_info.h"
#include "orte/mca/common/pmi/common_pmi.h"
#include "grpcomm_pmi.h"

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

@ -24,9 +24,9 @@
#include "opal/dss/dss.h"
#include "opal/mca/hwloc/base/base.h"
#include "opal/mca/common/pmi/common_pmi.h"
#include "opal/mca/db/db.h"
#include "orte/mca/common/pmi/common_pmi.h"
#include "orte/mca/db/db.h"
#include "orte/mca/errmgr/errmgr.h"
#include "orte/mca/rml/rml.h"
#include "orte/util/name_fns.h"
@ -70,7 +70,7 @@ static int init(void)
max_length = 1024;
#else
if (PMI_SUCCESS != (rc = PMI_KVS_Get_name_length_max(&max_length))) {
ORTE_PMI_ERROR(rc, "PMI_KVS_Get_name_length_max");
OPAL_PMI_ERROR(rc, "PMI_KVS_Get_name_length_max");
return ORTE_ERROR;
}
#endif
@ -85,7 +85,7 @@ static int init(void)
rc = PMI_KVS_Get_my_name(pmi_kvs_name,max_length);
#endif
if (PMI_SUCCESS != rc) {
ORTE_PMI_ERROR(rc, "PMI_KVS_Get_my_name");
OPAL_PMI_ERROR(rc, "PMI_KVS_Get_my_name");
return ORTE_ERROR;
}
return ORTE_SUCCESS;
@ -139,13 +139,13 @@ static int pmi_barrier(orte_grpcomm_collective_t *coll)
#if WANT_CRAY_PMI2_EXT
/* Cray doesn't provide a barrier, so use the Fence function here */
if (PMI_SUCCESS != (rc = PMI2_KVS_Fence())) {
ORTE_PMI_ERROR(rc, "PMI2_KVS_Fence");
OPAL_PMI_ERROR(rc, "PMI2_KVS_Fence");
return ORTE_ERROR;
}
#else
/* use the PMI barrier function */
if (PMI_SUCCESS != (rc = PMI_Barrier())) {
ORTE_PMI_ERROR(rc, "PMI_Barrier");
OPAL_PMI_ERROR(rc, "PMI_Barrier");
return ORTE_ERROR;
}
#endif
@ -171,15 +171,23 @@ static int pmi_allgather(orte_grpcomm_collective_t *coll)
/*** MODEX SECTION ***/
static int modex(orte_grpcomm_collective_t *coll)
{
char *rml_uri;
char *cptr, **fields;
orte_vpid_t v;
orte_process_name_t name;
int rc;
opal_identifier_t *id;
opal_hwloc_level_t bind_level;
opal_hwloc_locality_t locality;
unsigned int bind_idx;
orte_local_rank_t local_rank;
orte_node_rank_t node_rank;
OPAL_OUTPUT_VERBOSE((1, orte_grpcomm_base.output,
"%s grpcomm:pmi: modex entered",
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME)));
/* our RTE data was constructed and pushed in the ESS pmi component */
/* commit our modex info */
#if WANT_CRAY_PMI2_EXT
PMI2_KVS_Fence();
@ -188,7 +196,7 @@ static int modex(orte_grpcomm_collective_t *coll)
int rc;
if (PMI_SUCCESS != (rc = PMI_KVS_Commit(pmi_kvs_name))) {
ORTE_PMI_ERROR(rc, "PMI_KVS_Commit");
OPAL_PMI_ERROR(rc, "PMI_KVS_Commit");
return ORTE_ERR_FATAL;
}
/* Barrier here to ensure all other procs have committed */
@ -196,29 +204,106 @@ static int modex(orte_grpcomm_collective_t *coll)
}
#endif
/* cycle thru all my peers and collect their contact info in
* case I need to send an RML message to them
*/
/* cycle thru all my peers and collect their RTE info */
name.jobid = ORTE_PROC_MY_NAME->jobid;
id = (opal_identifier_t*)&name;
fields = NULL;
for (v=0; v < orte_process_info.num_procs; v++) {
if (v == ORTE_PROC_MY_NAME->vpid) {
continue;
}
name.vpid = v;
if (ORTE_SUCCESS != (rc = orte_db.fetch(&name, ORTE_DB_RMLURI, (void **)&rml_uri, OPAL_STRING))) {
/* fetch the RTE data for this proc */
if (ORTE_SUCCESS != (rc = opal_db.fetch((*id), "RTE", (void **)&cptr, OPAL_STRING))) {
ORTE_ERROR_LOG(rc);
return rc;
}
/* split on commas */
fields = opal_argv_split(cptr, ',');
free(cptr);
/* sanity check */
if (6 != opal_argv_count(fields)) {
ORTE_ERROR_LOG(ORTE_ERR_BAD_PARAM);
opal_argv_free(fields);
return ORTE_ERR_BAD_PARAM;
}
/* store the composite parts */
/* first field is the URI */
if (ORTE_SUCCESS != (rc = opal_db.store((*id), OPAL_DB_INTERNAL, ORTE_DB_RMLURI, fields[0], OPAL_STRING))) {
ORTE_ERROR_LOG(rc);
opal_argv_free(fields);
return rc;
}
OPAL_OUTPUT_VERBOSE((2, orte_grpcomm_base.output,
"%s grpcomm:pmi: proc %s oob endpoint %s",
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
ORTE_NAME_PRINT(&name), rml_uri));
ORTE_NAME_PRINT(&name), fields[0]));
/* set the contact info into the hash table */
if (ORTE_SUCCESS != (rc = orte_rml.set_contact_info(rml_uri))) {
free(rml_uri);
if (ORTE_SUCCESS != (rc = orte_rml.set_contact_info(fields[0]))) {
opal_argv_free(fields);
return rc;
}
free(rml_uri);
/* next is the hostname */
if (ORTE_SUCCESS != (rc = opal_db.store((*id), OPAL_DB_INTERNAL, ORTE_DB_HOSTNAME, fields[1], OPAL_STRING))) {
ORTE_ERROR_LOG(rc);
opal_argv_free(fields);
return rc;
}
/* next is the bind level */
bind_level = strtoul(fields[2], NULL, 10);
if (ORTE_SUCCESS != (rc = opal_db.store((*id), OPAL_DB_INTERNAL, ORTE_DB_BIND_LEVEL, &bind_level, OPAL_HWLOC_LEVEL_T))) {
ORTE_ERROR_LOG(rc);
opal_argv_free(fields);
return rc;
}
/* next is the bind index */
bind_idx = strtoul(fields[3], NULL, 10);
if (ORTE_SUCCESS != (rc = opal_db.store((*id), OPAL_DB_INTERNAL, ORTE_DB_BIND_INDEX, &bind_idx, OPAL_UINT))) {
ORTE_ERROR_LOG(rc);
opal_argv_free(fields);
return rc;
}
/* local rank */
local_rank = strtoul(fields[4], NULL, 10);
if (ORTE_SUCCESS != (rc = opal_db.store((*id), OPAL_DB_INTERNAL, ORTE_DB_LOCALRANK, &local_rank, ORTE_LOCAL_RANK))) {
ORTE_ERROR_LOG(rc);
opal_argv_free(fields);
return rc;
}
/* node rank */
node_rank = strtoul(fields[5], NULL, 10);
if (ORTE_SUCCESS != (rc = opal_db.store((*id), OPAL_DB_INTERNAL, ORTE_DB_NODERANK, &node_rank, ORTE_NODE_RANK))) {
ORTE_ERROR_LOG(rc);
opal_argv_free(fields);
return rc;
}
/* compute and store the locality as it isn't something that gets pushed to PMI */
if (0 != strcmp(fields[1], orte_process_info.nodename)) {
/* this is on a different node, then mark as non-local */
locality = OPAL_PROC_NON_LOCAL;
} else if (OPAL_HWLOC_NODE_LEVEL == bind_level) {
/* if we share a node, but we don't know anything more, then
* mark us as on the node as this is all we know
*/
locality = OPAL_PROC_ON_NODE;
} else {
/* determine relative location on our node */
locality = opal_hwloc_base_get_relative_locality(opal_hwloc_topology,
orte_process_info.bind_level,
orte_process_info.bind_idx,
bind_level, bind_idx);
}
if (ORTE_SUCCESS != (rc = opal_db.store((*id), OPAL_DB_INTERNAL, ORTE_DB_LOCALITY, &locality, OPAL_HWLOC_LOCALITY_T))) {
ORTE_ERROR_LOG(rc);
opal_argv_free(fields);
return rc;
}
/* cleanup */
opal_argv_free(fields);
fields = NULL;
}
/* execute the callback */
@ -226,5 +311,5 @@ static int modex(orte_grpcomm_collective_t *coll)
if (NULL != coll->cbfunc) {
coll->cbfunc(NULL, coll->cbdata);
}
return ORTE_SUCCESS;
return rc;
}

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

@ -29,6 +29,7 @@
#endif
#include "opal/mca/base/mca_base_param.h"
#include "opal/mca/db/db.h"
#include "opal/mca/hwloc/hwloc.h"
#include "opal/util/argv.h"
#include "opal/util/output.h"
@ -37,7 +38,6 @@
#include "opal/dss/dss.h"
#include "opal/threads/threads.h"
#include "orte/mca/db/db.h"
#include "orte/mca/errmgr/errmgr.h"
#include "orte/mca/rml/rml.h"
#include "orte/util/proc_info.h"
@ -491,6 +491,7 @@ char* orte_get_proc_hostname(orte_process_name_t *proc)
orte_proc_t *proct;
char *hostname;
int rc;
opal_identifier_t *id;
if (ORTE_PROC_IS_DAEMON || ORTE_PROC_IS_HNP) {
/* look it up on our arrays */
@ -506,7 +507,8 @@ char* orte_get_proc_hostname(orte_process_name_t *proc)
}
/* if we are an app, get the pointer from the modex db */
if (ORTE_SUCCESS != (rc = orte_db.fetch_pointer(proc, ORTE_DB_HOSTNAME,
id = (opal_identifier_t*)proc;
if (ORTE_SUCCESS != (rc = opal_db.fetch_pointer((*id), ORTE_DB_HOSTNAME,
(void**)&hostname, OPAL_STRING))) {
ORTE_ERROR_LOG(rc);
return NULL;
@ -519,6 +521,7 @@ orte_node_rank_t orte_get_proc_node_rank(orte_process_name_t *proc)
orte_proc_t *proct;
orte_node_rank_t noderank, *nr;
int rc;
opal_identifier_t *id;
if (ORTE_PROC_IS_DAEMON || ORTE_PROC_IS_HNP) {
/* look it up on our arrays */
@ -531,7 +534,8 @@ orte_node_rank_t orte_get_proc_node_rank(orte_process_name_t *proc)
/* if we are an app, get the value from the modex db */
nr = &noderank;
if (ORTE_SUCCESS != (rc = orte_db.fetch_pointer(proc, ORTE_DB_NODERANK,
id = (opal_identifier_t*)proc;
if (ORTE_SUCCESS != (rc = opal_db.fetch_pointer((*id), ORTE_DB_NODERANK,
(void**)&nr, ORTE_NODE_RANK))) {
ORTE_ERROR_LOG(rc);
return ORTE_NODE_RANK_INVALID;

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

@ -115,6 +115,20 @@ ORTE_DECLSPEC extern int orte_exit_status;
#define ORTE_SYS_PRI OPAL_EV_SYS_LO_PRI
#define ORTE_INFO_PRI OPAL_EV_INFO_LO_PRI
/* define some common keys used in ORTE */
#define ORTE_DB_HOSTNAME "orte.hostname"
#define ORTE_DB_DAEMON_VPID "orte.daemon.vpid"
#define ORTE_DB_NODERANK "orte.node.rank"
#define ORTE_DB_LOCALRANK "orte.local.rank"
#define ORTE_DB_BIND_LEVEL "orte.bind.level"
#define ORTE_DB_BIND_INDEX "orte.bind.index"
#define ORTE_DB_LOCALITY "orte.locality"
#define ORTE_DB_ARCH "orte.arch"
#define ORTE_DB_NPROCS "orte.nprocs"
#define ORTE_DB_RMLURI "orte.rmluri"
#define ORTE_DB_BIND_BITMAP "orte.bind.bitmap"
/* State Machine lists */
ORTE_DECLSPEC extern opal_list_t orte_job_states;
ORTE_DECLSPEC extern opal_list_t orte_proc_states;

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

@ -10,7 +10,7 @@
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2006-2012 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2010-2012 Los Alamos National Security, LLC.
* Copyright (c) 2010-2013 Los Alamos National Security, LLC.
* All rights reserved.
* Copyright (c) 2011-2012 University of Houston. All rights reserved.
* $COPYRIGHT$
@ -27,7 +27,6 @@
#include "opal/class/opal_pointer_array.h"
#include "opal/runtime/opal_info_support.h"
#include "orte/mca/db/base/base.h"
#include "orte/mca/dfs/base/base.h"
#include "orte/mca/errmgr/base/base.h"
#include "orte/mca/ess/base/base.h"
@ -59,7 +58,6 @@ const char *orte_info_type_orte = "orte";
void orte_info_register_types(opal_pointer_array_t *mca_types)
{
/* frameworks */
opal_pointer_array_add(mca_types, "db");
opal_pointer_array_add(mca_types, "dfs");
opal_pointer_array_add(mca_types, "errmgr");
opal_pointer_array_add(mca_types, "ess");
@ -131,20 +129,6 @@ int orte_info_register_components(opal_pointer_array_t *mca_types,
goto error;
}
if (ORTE_SUCCESS != (rc = orte_db_base_open()) &&
ORTE_ERR_BAD_PARAM != rc) {
str = "db_base_open";
goto error;
}
map = OBJ_NEW(opal_info_component_map_t);
map->type = strdup("db");
map->components = &orte_db_base.available_components;
opal_pointer_array_add(component_map, map);
if (ORTE_ERR_BAD_PARAM == rc) {
str = "db";
goto breakout;
}
if (ORTE_SUCCESS != (rc = orte_dfs_base_open()) &&
ORTE_ERR_BAD_PARAM != rc) {
str = "dfs_base_open";
@ -413,7 +397,6 @@ int orte_info_register_components(opal_pointer_array_t *mca_types,
void orte_info_close_components(void)
{
(void) orte_db_base_close();
(void) orte_errmgr_base_close();
(void) orte_ess_base_close();
(void) orte_filem_base_close();

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

@ -10,7 +10,7 @@
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2010-2011 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2011-2012 Los Alamos National Security, LLC.
* Copyright (c) 2011-2013 Los Alamos National Security, LLC.
* All rights reserved.
* $COPYRIGHT$
*
@ -184,9 +184,6 @@ int orte_err2str(int errnum, const char **errmsg)
case ORTE_ERR_SENSOR_LIMIT_EXCEEDED:
retval = "Sensor limit exceeded";
break;
case ORTE_ERR_JOB_ENTRY_NOT_FOUND:
retval = "Job entry not found";
break;
case ORTE_ERR_PROC_ENTRY_NOT_FOUND:
retval = "Proc entry not found";
break;

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

@ -9,7 +9,7 @@
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2012 Los Alamos National Security, LLC.
* Copyright (c) 2012-2013 Los Alamos National Security, LLC.
* All rights reserved.
*
* $COPYRIGHT$
@ -49,13 +49,13 @@
#include "opal/dss/dss.h"
#include "opal/runtime/opal.h"
#include "opal/class/opal_pointer_array.h"
#include "opal/mca/db/db.h"
#include "opal/mca/hwloc/base/base.h"
#include "opal/util/net.h"
#include "opal/util/output.h"
#include "opal/util/argv.h"
#include "opal/datatype/opal_datatype.h"
#include "orte/mca/db/db.h"
#include "orte/mca/dfs/dfs.h"
#include "orte/mca/errmgr/errmgr.h"
#include "orte/mca/odls/base/odls_private.h"
@ -158,7 +158,8 @@ int orte_util_build_daemon_nidmap(char **nodes)
orte_process_name_t proc;
char *uri, *addr;
char *proc_name;
opal_identifier_t *id;
num_nodes = opal_argv_count(nodes);
OPAL_OUTPUT_VERBOSE((2, orte_nidmap_output,
@ -173,12 +174,13 @@ int orte_util_build_daemon_nidmap(char **nodes)
/* install the entry for the HNP */
proc.jobid = ORTE_PROC_MY_NAME->jobid;
proc.vpid = 0;
if (ORTE_SUCCESS != (rc = orte_db.store(&proc, ORTE_DB_DAEMON_VPID, &proc.vpid, ORTE_VPID))) {
id = (opal_identifier_t*)&proc;
if (ORTE_SUCCESS != (rc = opal_db.store((*id), OPAL_DB_INTERNAL, ORTE_DB_DAEMON_VPID, &proc.vpid, OPAL_UINT32))) {
ORTE_ERROR_LOG(rc);
return rc;
}
addr = "HNP";
if (ORTE_SUCCESS != (rc = orte_db.store(&proc, ORTE_DB_HOSTNAME, addr, OPAL_STRING))) {
if (ORTE_SUCCESS != (rc = opal_db.store((*id), OPAL_DB_INTERNAL, ORTE_DB_HOSTNAME, addr, OPAL_STRING))) {
ORTE_ERROR_LOG(rc);
return rc;
}
@ -192,14 +194,14 @@ int orte_util_build_daemon_nidmap(char **nodes)
/* define the vpid for this daemon */
proc.vpid = i+1;
/* store the hostname for the proc */
if (ORTE_SUCCESS != (rc = orte_db.store(&proc, ORTE_DB_HOSTNAME, nodes[i], OPAL_STRING))) {
if (ORTE_SUCCESS != (rc = opal_db.store((*id), OPAL_DB_INTERNAL, ORTE_DB_HOSTNAME, nodes[i], OPAL_STRING))) {
ORTE_ERROR_LOG(rc);
return rc;
}
/* the arch defaults to our arch so that non-hetero
* case will yield correct behavior
*/
if (ORTE_SUCCESS != (rc = orte_db.store(&proc, ORTE_DB_ARCH, &opal_local_arch, OPAL_UINT32))) {
if (ORTE_SUCCESS != (rc = opal_db.store((*id), OPAL_DB_INTERNAL, ORTE_DB_ARCH, &opal_local_arch, OPAL_UINT32))) {
ORTE_ERROR_LOG(rc);
return rc;
}
@ -351,6 +353,7 @@ int orte_util_decode_nodemap(opal_byte_object_t *bo)
int rc=ORTE_SUCCESS;
uint8_t oversub;
char *nodename;
opal_identifier_t *id;
OPAL_OUTPUT_VERBOSE((1, orte_nidmap_output,
"%s decode:nidmap decoding nodemap",
@ -378,7 +381,8 @@ int orte_util_decode_nodemap(opal_byte_object_t *bo)
ORTE_ERROR_LOG(rc);
return rc;
}
if (ORTE_SUCCESS != (rc = orte_db.store(&daemon, ORTE_DB_HOSTNAME, nodename, OPAL_STRING))) {
id = (opal_identifier_t*)&daemon;
if (ORTE_SUCCESS != (rc = opal_db.store((*id), OPAL_DB_INTERNAL, ORTE_DB_HOSTNAME, nodename, OPAL_STRING))) {
ORTE_ERROR_LOG(rc);
return rc;
}
@ -387,7 +391,8 @@ int orte_util_decode_nodemap(opal_byte_object_t *bo)
"%s storing nodename %s for daemon %s",
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
nodename, ORTE_VPID_PRINT(daemon.vpid));
if (ORTE_SUCCESS != (rc = orte_db.store(ORTE_NAME_WILDCARD, nodename, &daemon.vpid, ORTE_VPID))) {
id = (opal_identifier_t*)ORTE_NAME_WILDCARD;
if (ORTE_SUCCESS != (rc = opal_db.store((*id), OPAL_DB_INTERNAL, nodename, &daemon.vpid, OPAL_UINT32))) {
ORTE_ERROR_LOG(rc);
return rc;
}
@ -399,11 +404,12 @@ int orte_util_decode_nodemap(opal_byte_object_t *bo)
/* if this is my daemon, then store the data for me too */
if (daemon.vpid == ORTE_PROC_MY_DAEMON->vpid) {
if (ORTE_SUCCESS != (rc = orte_db.store(ORTE_PROC_MY_NAME, ORTE_DB_HOSTNAME, nodename, OPAL_STRING))) {
id = (opal_identifier_t*)ORTE_PROC_MY_NAME;
if (ORTE_SUCCESS != (rc = opal_db.store((*id), OPAL_DB_INTERNAL, ORTE_DB_HOSTNAME, nodename, OPAL_STRING))) {
ORTE_ERROR_LOG(rc);
return rc;
}
if (ORTE_SUCCESS != (rc = orte_db.store(ORTE_PROC_MY_NAME, ORTE_DB_DAEMON_VPID, &daemon.vpid, ORTE_VPID))) {
if (ORTE_SUCCESS != (rc = opal_db.store((*id), OPAL_DB_INTERNAL, ORTE_DB_DAEMON_VPID, &daemon.vpid, OPAL_UINT32))) {
ORTE_ERROR_LOG(rc);
return rc;
}
@ -429,7 +435,8 @@ int orte_util_decode_nodemap(opal_byte_object_t *bo)
"%s storing alias %s for daemon %s",
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
alias, ORTE_VPID_PRINT(daemon.vpid));
if (ORTE_SUCCESS != (rc = orte_db.store(ORTE_NAME_WILDCARD, alias, &daemon.vpid, ORTE_VPID))) {
id = (opal_identifier_t*)ORTE_NAME_WILDCARD;
if (ORTE_SUCCESS != (rc = opal_db.store((*id), OPAL_DB_INTERNAL, alias, &daemon.vpid, OPAL_UINT32))) {
ORTE_ERROR_LOG(rc);
return rc;
}
@ -776,6 +783,7 @@ int orte_util_decode_pidmap(opal_byte_object_t *bo)
uint8_t flag;
opal_buffer_t *bptr;
bool barrier;
opal_identifier_t *id;
/* xfer the byte object to a buffer for unpacking */
OBJ_CONSTRUCT(&buf, opal_buffer_t);
@ -807,7 +815,8 @@ int orte_util_decode_pidmap(opal_byte_object_t *bo)
goto cleanup;
}
proc.vpid = ORTE_VPID_INVALID;
if (ORTE_SUCCESS != (rc = orte_db.store(&proc, ORTE_DB_NPROCS, &num_procs, ORTE_VPID))) {
id = (opal_identifier_t*)&proc;
if (ORTE_SUCCESS != (rc = opal_db.store((*id), OPAL_DB_INTERNAL, ORTE_DB_NPROCS, &num_procs, OPAL_UINT32))) {
ORTE_ERROR_LOG(rc);
goto cleanup;
}
@ -821,7 +830,7 @@ int orte_util_decode_pidmap(opal_byte_object_t *bo)
}
/* store it */
proc.vpid = ORTE_VPID_INVALID;
if (ORTE_SUCCESS != (rc = orte_db.store(&proc, ORTE_DB_BIND_LEVEL, &bind_level, OPAL_HWLOC_LEVEL_T))) {
if (ORTE_SUCCESS != (rc = opal_db.store((*id), OPAL_DB_INTERNAL, ORTE_DB_BIND_LEVEL, &bind_level, OPAL_HWLOC_LEVEL_T))) {
ORTE_ERROR_LOG(rc);
goto cleanup;
}
@ -905,20 +914,20 @@ int orte_util_decode_pidmap(opal_byte_object_t *bo)
goto cleanup;
}
/* store the values in the database */
if (ORTE_SUCCESS != (rc = orte_db.store(&proc, ORTE_DB_LOCALRANK, &local_rank, ORTE_LOCAL_RANK))) {
if (ORTE_SUCCESS != (rc = opal_db.store((*id), OPAL_DB_INTERNAL, ORTE_DB_LOCALRANK, &local_rank, ORTE_LOCAL_RANK))) {
ORTE_ERROR_LOG(rc);
goto cleanup;
}
if (ORTE_SUCCESS != (rc = orte_db.store(&proc, ORTE_DB_NODERANK, &node_rank, ORTE_NODE_RANK))) {
if (ORTE_SUCCESS != (rc = opal_db.store((*id), OPAL_DB_INTERNAL, ORTE_DB_NODERANK, &node_rank, ORTE_NODE_RANK))) {
ORTE_ERROR_LOG(rc);
goto cleanup;
}
#if OPAL_HAVE_HWLOC
if (ORTE_SUCCESS != (rc = orte_db.store(&proc, ORTE_DB_BIND_INDEX, &bind_idx, OPAL_UINT))) {
if (ORTE_SUCCESS != (rc = opal_db.store((*id), OPAL_DB_INTERNAL, ORTE_DB_BIND_INDEX, &bind_idx, OPAL_UINT))) {
ORTE_ERROR_LOG(rc);
goto cleanup;
}
if (ORTE_SUCCESS != (rc = orte_db.store(&proc, ORTE_DB_BIND_BITMAP, cpu_bitmap, OPAL_STRING))) {
if (ORTE_SUCCESS != (rc = opal_db.store((*id), OPAL_DB_INTERNAL, ORTE_DB_BIND_BITMAP, cpu_bitmap, OPAL_STRING))) {
ORTE_ERROR_LOG(rc);
goto cleanup;
}
@ -930,16 +939,18 @@ int orte_util_decode_pidmap(opal_byte_object_t *bo)
if (proc.jobid != ORTE_PROC_MY_NAME->jobid ||
proc.vpid != ORTE_PROC_MY_NAME->vpid) {
/* store the data for this proc */
if (ORTE_SUCCESS != (rc = orte_db.store(&proc, ORTE_DB_DAEMON_VPID, &dmn.vpid, ORTE_VPID))) {
if (ORTE_SUCCESS != (rc = opal_db.store((*id), OPAL_DB_INTERNAL, ORTE_DB_DAEMON_VPID, &dmn.vpid, OPAL_UINT32))) {
ORTE_ERROR_LOG(rc);
goto cleanup;
}
/* lookup and store the hostname for this proc */
if (ORTE_SUCCESS != (rc = orte_db.fetch_pointer(&dmn, ORTE_DB_HOSTNAME, (void**)&hostname, OPAL_STRING))) {
id = (opal_identifier_t*)&dmn;
if (ORTE_SUCCESS != (rc = opal_db.fetch_pointer((*id), ORTE_DB_HOSTNAME, (void**)&hostname, OPAL_STRING))) {
ORTE_ERROR_LOG(rc);
goto cleanup;
}
if (ORTE_SUCCESS != (rc = orte_db.store(&proc, ORTE_DB_HOSTNAME, hostname, OPAL_STRING))) {
id = (opal_identifier_t*)&proc;
if (ORTE_SUCCESS != (rc = opal_db.store((*id), OPAL_DB_INTERNAL, ORTE_DB_HOSTNAME, hostname, OPAL_STRING))) {
ORTE_ERROR_LOG(rc);
goto cleanup;
}
@ -978,7 +989,8 @@ int orte_util_decode_pidmap(opal_byte_object_t *bo)
/* recover the number of procs in this job */
vptr = &num_procs;
proc.vpid = ORTE_VPID_INVALID;
if (ORTE_SUCCESS != (rc = orte_db.fetch(&proc, ORTE_DB_NPROCS, (void**)&vptr, ORTE_VPID))) {
id = (opal_identifier_t*)&proc;
if (ORTE_SUCCESS != (rc = opal_db.fetch((*id), ORTE_DB_NPROCS, (void**)&vptr, OPAL_UINT32))) {
ORTE_ERROR_LOG(rc);
goto cleanup;
}
@ -992,7 +1004,7 @@ int orte_util_decode_pidmap(opal_byte_object_t *bo)
proc.vpid = i;
/* recover the daemon for this proc */
vptr = &daemon;
if (ORTE_SUCCESS != (rc = orte_db.fetch(&proc, ORTE_DB_DAEMON_VPID, (void**)&vptr, ORTE_VPID))) {
if (ORTE_SUCCESS != (rc = opal_db.fetch((*id), ORTE_DB_DAEMON_VPID, (void**)&vptr, OPAL_UINT32))) {
if (orte_staged_execution) {
/* when using staged execution, we will see processes that have not
* yet been launched and thus do not have a daemon assigned to them.
@ -1018,7 +1030,7 @@ int orte_util_decode_pidmap(opal_byte_object_t *bo)
/* retrieve the bind level for the other proc's job */
lvptr = &pbind;
proc.vpid = ORTE_VPID_INVALID;
if (ORTE_SUCCESS != (rc = orte_db.fetch(&proc, ORTE_DB_BIND_LEVEL, (void**)&lvptr, OPAL_HWLOC_LEVEL_T))) {
if (ORTE_SUCCESS != (rc = opal_db.fetch((*id), ORTE_DB_BIND_LEVEL, (void**)&lvptr, OPAL_HWLOC_LEVEL_T))) {
ORTE_ERROR_LOG(rc);
goto cleanup;
}
@ -1026,7 +1038,7 @@ int orte_util_decode_pidmap(opal_byte_object_t *bo)
/* retrieve the other's proc's bind idx */
uiptr = &pbidx;
proc.vpid = i;
if (ORTE_SUCCESS != (rc = orte_db.fetch(&proc, ORTE_DB_BIND_INDEX, (void**)&uiptr, OPAL_UINT))) {
if (ORTE_SUCCESS != (rc = opal_db.fetch((*id), ORTE_DB_BIND_INDEX, (void**)&uiptr, OPAL_UINT))) {
ORTE_ERROR_LOG(rc);
goto cleanup;
}
@ -1055,7 +1067,7 @@ int orte_util_decode_pidmap(opal_byte_object_t *bo)
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
ORTE_NAME_PRINT(&proc),
opal_hwloc_base_print_locality(locality)));
if (ORTE_SUCCESS != (rc = orte_db.store(&proc, ORTE_DB_LOCALITY, &locality, OPAL_HWLOC_LOCALITY_T))) {
if (ORTE_SUCCESS != (rc = opal_db.store((*id), OPAL_DB_INTERNAL, ORTE_DB_LOCALITY, &locality, OPAL_HWLOC_LOCALITY_T))) {
ORTE_ERROR_LOG(rc);
goto cleanup;
}