bd9265c560
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.
180 строки
6.1 KiB
C
180 строки
6.1 KiB
C
/*
|
|
* 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$
|
|
*/
|
|
/** @file:
|
|
*
|
|
* The Database Framework
|
|
*
|
|
*/
|
|
|
|
#ifndef OPAL_DB_H
|
|
#define OPAL_DB_H
|
|
|
|
#include "opal_config.h"
|
|
#include "opal/types.h"
|
|
|
|
#include "opal/mca/mca.h"
|
|
#include "opal/dss/dss_types.h"
|
|
|
|
#include "opal/mca/db/db_types.h"
|
|
|
|
/**
|
|
* DATABASE DESIGN
|
|
*
|
|
* 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.
|
|
*/
|
|
|
|
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 (*opal_db_base_module_init_fn_t)(void);
|
|
|
|
/*
|
|
* Finalize the module
|
|
*/
|
|
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 (*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 (*opal_db_base_module_store_pointer_fn_t)(opal_identifier_t proc,
|
|
opal_db_locality_t locality,
|
|
opal_value_t *kv);
|
|
|
|
/*
|
|
* Retrieve data
|
|
*
|
|
* Retrieve data for the given proc associated with the specified key. Wildcards
|
|
* are supported here as well. Caller is responsible for releasing any returned
|
|
* object.
|
|
*/
|
|
typedef int (*opal_db_base_module_fetch_fn_t)(opal_identifier_t proc,
|
|
const char *key,
|
|
void **data, opal_data_type_t type);
|
|
|
|
/*
|
|
* Retrieve a pointer to data
|
|
*
|
|
* Retrieve a pointer to the data for the given proc associated with the specified key. Wildcards
|
|
* are supported here as well. Callers are cautioned against modifying the data as this
|
|
* will directly alter information in the database! A local copy of the data should be made
|
|
* wherever modification is possible.
|
|
*/
|
|
typedef int (*opal_db_base_module_fetch_pointer_fn_t)(opal_identifier_t proc,
|
|
const char *key,
|
|
void **data, opal_data_type_t type);
|
|
/*
|
|
* Retrieve multiple data elements
|
|
*
|
|
* 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 (*opal_db_base_module_fetch_multiple_fn_t)(opal_identifier_t proc,
|
|
const char *key,
|
|
opal_list_t *kvs);
|
|
|
|
/*
|
|
* Delete data
|
|
*
|
|
* Delete the data associated with the specified key. If a NULL key is provided,
|
|
* all data for the given proc will be deleted.
|
|
*
|
|
* This function also supports wildcard values in the proc field. A NULL proc indicates
|
|
* that ALL data in the database is to be purged. A WILDCARD vpid will delete all matching
|
|
* keys from that jobid. Etc.
|
|
*/
|
|
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 (*opal_db_base_module_add_log_fn_t)(const char *table, const opal_value_t *kvs, int nkvs);
|
|
|
|
/*
|
|
* the standard module data structure
|
|
*/
|
|
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 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 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 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 OPAL_DB_BASE_VERSION_1_0_0 \
|
|
MCA_BASE_VERSION_2_0_0, \
|
|
"db", 1, 0, 0
|
|
|
|
/* Global structure for accessing DB functions */
|
|
OPAL_DECLSPEC extern opal_db_base_module_t opal_db; /* holds base function pointers */
|
|
|
|
END_C_DECLS
|
|
|
|
#endif
|