diff --git a/src/mca/gpr/base/base.h b/src/mca/gpr/base/base.h index ebe1f2153b..6bd1462bab 100644 --- a/src/mca/gpr/base/base.h +++ b/src/mca/gpr/base/base.h @@ -72,14 +72,9 @@ extern "C" { */ extern int mca_gpr_base_output; extern mca_gpr_base_module_t ompi_registry; /* holds selected module's function pointers */ -extern ompi_list_t mca_gpr_base_modules_available; +extern bool mca_gpr_base_selected; +extern ompi_list_t mca_gpr_base_components_available; extern mca_gpr_base_component_t mca_gpr_base_selected_component; -/* - * Base functions that are common to all implementations - can be overridden - */ - -int gpr_base_send(ompi_process_name_t *target, mca_gpr_buffer_t *buf, mca_gpr_buffer_size_t size); -mca_gpr_buffer_t gpr_base_recv(void); #endif diff --git a/src/mca/gpr/base/gpr_base_close.c b/src/mca/gpr/base/gpr_base_close.c index 3cb2031cec..43097d6903 100644 --- a/src/mca/gpr/base/gpr_base_close.c +++ b/src/mca/gpr/base/gpr_base_close.c @@ -23,7 +23,7 @@ int mca_gpr_base_close(void) /* Close all remaining available components (may be one if this is a OMPI RTE program, or [possibly] multiple if this is ompi_info) */ - mca_base_modules_close(mca_gpr_base_output, + mca_base_components_close(mca_gpr_base_output, &mca_gpr_base_components_available, NULL); /* All done */ diff --git a/src/mca/gpr/base/gpr_base_open.c b/src/mca/gpr/base/gpr_base_open.c index 7659d1b0b2..8ab70dae67 100644 --- a/src/mca/gpr/base/gpr_base_open.c +++ b/src/mca/gpr/base/gpr_base_open.c @@ -16,7 +16,7 @@ * component's public mca_base_module_t struct. */ -#include "mca/gpr/base/static-modules.h" +#include "mca/gpr/base/static-components.h" /* * globals @@ -51,7 +51,7 @@ OBJ_CLASS_INSTANCE( */ int mca_gpr_base_output = -1; mca_gpr_base_module_t ompi_registry; -/* bool mca_gpr_base_selected = false; */ +bool mca_gpr_base_selected = false; ompi_list_t mca_gpr_base_components_available; mca_gpr_base_component_t mca_gpr_base_selected_component; @@ -66,7 +66,7 @@ int mca_gpr_base_open(void) /* Open up all available components */ if (OMPI_SUCCESS != - mca_base_modules_open("gpr", 0, mca_gpr_base_static_modules, + mca_base_components_open("gpr", 0, mca_gpr_base_static_components, &mca_gpr_base_components_available)) { return OMPI_ERROR; } diff --git a/src/mca/gpr/base/gpr_base_select.c b/src/mca/gpr/base/gpr_base_select.c index 62897e3f45..4fd9670631 100644 --- a/src/mca/gpr/base/gpr_base_select.c +++ b/src/mca/gpr/base/gpr_base_select.c @@ -15,7 +15,6 @@ #include "util/proc_info.h" #include "mca/mca.h" #include "mca/base/base.h" -#include "mca/gpr/gpr.h" #include "mca/gpr/base/base.h" @@ -27,9 +26,9 @@ int mca_gpr_base_select(bool *allow_multi_user_threads, bool *have_hidden_threads) { ompi_list_item_t *item; - mca_base_module_list_item_t *mli; + mca_base_component_list_item_t *cli; mca_gpr_base_component_t *component, *best_component = NULL; - mca_gpr_t *module, *best_module = NULL; + mca_gpr_base_module_t *module, *best_module = NULL; bool multi, hidden; int priority, best_priority = -1; @@ -38,8 +37,8 @@ int mca_gpr_base_select(bool *allow_multi_user_threads, for (item = ompi_list_get_first(&mca_gpr_base_components_available); item != ompi_list_get_end(&mca_gpr_base_components_available); item = ompi_list_get_next(item)) { - mli = (mca_base_module_list_item_t *) item; - component = (mca_gpr_base_component_t *) mli->mli_module; + cli = (mca_base_component_list_item_t *) item; + component = (mca_gpr_base_component_t *) cli->cli_component; /* Call the component's init function and see if it wants to be selected */ diff --git a/src/mca/gpr/gpr.h b/src/mca/gpr/gpr.h index 62738c328d..4f2a2c462e 100644 --- a/src/mca/gpr/gpr.h +++ b/src/mca/gpr/gpr.h @@ -27,10 +27,11 @@ #include "include/types.h" #include "include/constants.h" #include "class/ompi_list.h" +#include "util/pack.h" #include "mca/mca.h" +#include "mca/oob/base/base.h" #include "mca/ns/base/base.h" -#include "mca/gpr/base/base.h" /** Define the notification actions for the subscription system */ @@ -61,79 +62,68 @@ * typedefs */ -typedef uint16_t ompi_registry_action_t; +typedef uint16_t ompi_registry_notify_action_t; typedef uint16_t ompi_registry_mode_t; +typedef ompi_buffer_t ompi_registry_object_t; +typedef uint32_t ompi_registry_object_size_t; +typedef char* ompi_registry_token_t; /* - * Global constants / types - */ -typedef mca_oob_base_msgbuf_t ompi_registry_buf_t; -typedef mca_oob_msgbuf_data_t ompi_registry_bufdata_t; -typedef ompi_registry_buf_t ompi_registry_object_t; - -/* - * Component functions + * structures */ -/* - * utility functions that may be provided, or use defaults +/** Return value structure for registry requests. + * A request for information stored within the registry returns a linked list of values that + * correspond to the provided tokens. The linked list is terminated by a "next" value of NULL. + * Each link in the list contains a pointer to a copy of the registry object, and the size + * of that object in bytes. Note that the pointer is to a \em copy of the object, and not + * to the registry object itself. This prevents inadvertent modification of the registry, but + * may require the recipient to release the structure's memory when done. */ -typedef int (*mca_gpr_base_module_send_fn_t)(ompi_process_name_t *target, - ompi_registry_buf_t *buf); -typedef ompi_registry_buf_t (*mca_gpr_base_module_recv_fn_t)(void); +struct ompi_registry_value_t { + ompi_list_item_t item; /**< Allows this item to be placed on a list */ + ompi_registry_object_t *object; /**< Pointer to object being returned */ + ompi_registry_object_size_t object_size; /**< Size of returned object, in bytes */ +}; +typedef struct ompi_registry_value_t ompi_registry_value_t; +OBJ_CLASS_DECLARATION(ompi_registry_value_t); + +/** Return value structure for index requests. + */ +struct ompi_registry_index_t { + ompi_list_item_t item; /**< Allows this item to be placed on a list */ + ompi_registry_token_t *token; /**< Pointer to the token string */ +}; +typedef struct ompi_registry_index_t ompi_registry_index_t; + +OBJ_CLASS_DECLARATION(ompi_registry_index_t); /* - * public functions that MUST be provided + * Component functions that MUST be provided */ typedef int (*mca_gpr_base_module_define_segment_fn_t)(char *segment); typedef int (*mca_gpr_base_module_delete_segment_fn_t)(char *segment); typedef int (*mca_gpr_base_module_put_fn_t)(ompi_registry_mode_t mode, char *segment, char **tokens, ompi_registry_object_t *object, - int size); + ompi_registry_object_size_t size); typedef ompi_registry_value_t* (*mca_gpr_base_module_get_fn_t)(ompi_registry_mode_t mode, char *segment, char **tokens); typedef int (*mca_gpr_base_module_delete_fn_t)(ompi_registry_mode_t mode, char *segment, char **tokens); -typedef ompi_keytable_t* (*mca_gpr_base_module_index_fn_t)(char *segment); +typedef ompi_registry_index_t* (*mca_gpr_base_module_index_fn_t)(char *segment); typedef int (*mca_gpr_base_module_subscribe_fn_t)(ompi_registry_mode_t mode, - ompi_registry_action_t action, + ompi_registry_notify_action_t action, char *segment, char **tokens); typedef int (*mca_gpr_base_module_unsubscribe_fn_t)(ompi_registry_mode_t mode, char *segment, char **tokens); -/* - * block functions that may be provided, or use defaults - */ -typedef ompi_registry_buf_t (*mca_gpr_base_module_getbuf_fn_t)(size_t size); -typedef int (*mca_gpr_base_module_packbuf_fn_t)(ompi_registry_buf_t *buf, void *ptr, - size_t num_items, ompi_registry_bufdata_t datatype); -typedef int (*mca_gpr_base_module_packstring_fn_t)(ompi_registry_buf_t *buf, char *string); -typedef int (*mca_gpr_base_module_unpackstring_fn_t)(ompi_registry_buf_t *buf, char *string, size_t maxlen); -typedef int (*mca_gpr_base_module_unpackbuf_fn_t)(ompi_registry_buf_t *buf, void *ptr, size_t num_items, - ompi_registry_bufdata_t datatype); -typedef int (*mca_gpr_base_module_sendbuf_fn_t)(ompi_process_name_t *target, ompi_registry_buf_t *buf, bool freebuf); - /* * Ver 1.0.0 */ -struct mca_gpr_base_component_1_0_0_t { - mca_base_component_t gprc_version; - mca_base_component_data_1_0_0_t gprc_data; - - mca_gpr_base_component_init_fn_t gprc_init; - mca_gpr_base_component_finalize_fn_t gprc_finalize; -}; -typedef struct mca_gpr_base_component_1_0_0_t mca_gpr_base_component_1_0_0_t; -typedef mca_gpr_base_component_1_0_0_t mca_gpr_base_component_t; - struct mca_gpr_base_module_1_0_0_t { - /* non-public utility functions - must be provided */ - mca_gpr_base_module_send_fn_t send; - mca_gpr_base_module_recv_fn_t recv; - /* public functions - must be provided */ mca_gpr_base_module_get_fn_t get; mca_gpr_base_module_put_fn_t put; mca_gpr_base_module_define_segment_fn_t define_segment; @@ -141,17 +131,37 @@ struct mca_gpr_base_module_1_0_0_t { mca_gpr_base_module_subscribe_fn_t subscribe; mca_gpr_base_module_unsubscribe_fn_t unsubscribe; mca_gpr_base_module_delete_fn_t delete; - /* block functions - may be provided */ - mca_gpr_base_module_getbuf_fn_t getbuf; - mca_gpr_base_module_packbuf_fn_t packbuf; - mca_gpr_base_module_packstring_fn_t pack_string; - mca_gpr_base_module_unpackstring_fn_t unpack_string; - mca_gpr_base_module_unpackbuf_fn_t unpack_buf; - mca_gpr_base_module_sendbuf_fn_t sendbuf; }; typedef struct mca_gpr_base_module_1_0_0_t mca_gpr_base_module_1_0_0_t; typedef mca_gpr_base_module_1_0_0_t mca_gpr_base_module_t; +/* + * GPR Component + */ + +typedef mca_gpr_base_module_t* (*mca_gpr_base_component_init_fn_t)( + bool *allow_multi_user_threads, + bool *have_hidden_threads, + int *priority); + +typedef int (*mca_gpr_base_component_finalize_fn_t)(void); + +/* + * the standard component data structure + */ + + +struct mca_gpr_base_component_1_0_0_t { + mca_base_component_t gpr_version; + mca_base_component_data_1_0_0_t gpr_data; + + mca_gpr_base_component_init_fn_t gpr_init; + mca_gpr_base_component_finalize_fn_t gpr_finalize; +}; +typedef struct mca_gpr_base_component_1_0_0_t mca_gpr_base_component_1_0_0_t; +typedef mca_gpr_base_component_1_0_0_t mca_gpr_base_component_t; + + /* * Macro for use in modules that are of type coll v1.0.0 */ diff --git a/src/mca/gpr/proxy/gpr_proxy.c b/src/mca/gpr/proxy/gpr_proxy.c index dd1d6fa63e..7da11ad69f 100644 --- a/src/mca/gpr/proxy/gpr_proxy.c +++ b/src/mca/gpr/proxy/gpr_proxy.c @@ -45,14 +45,14 @@ int gpr_proxy_delete(ompi_registry_mode_t mode, } -ompi_keytable_t* gpr_proxy_index(char *segment) +ompi_registry_index_t* gpr_proxy_index(char *segment) { return NULL; } int gpr_proxy_subscribe(ompi_registry_mode_t mode, - ompi_registry_action_t action, + ompi_registry_notify_action_t action, char *segment, char **tokens) { return OMPI_SUCCESS; diff --git a/src/mca/gpr/proxy/gpr_proxy.h b/src/mca/gpr/proxy/gpr_proxy.h index 4f8ef7b064..a01e8406a7 100644 --- a/src/mca/gpr/proxy/gpr_proxy.h +++ b/src/mca/gpr/proxy/gpr_proxy.h @@ -23,7 +23,7 @@ int mca_gpr_proxy_close(void); /* * Startup / Shutdown */ -mca_ns_t* mca_gpr_proxy_init(bool *allow_multi_user_threads, bool *have_hidden_threads, int *priority); +mca_gpr_base_module_t* mca_gpr_proxy_init(bool *allow_multi_user_threads, bool *have_hidden_threads, int *priority); int mca_gpr_proxy_finalize(void); /* @@ -59,14 +59,14 @@ int gpr_proxy_delete(ompi_registry_mode_t mode, /* * Implementation of index() */ -ompi_keytable_t* gpr_proxy_index(char *segment); +ompi_registry_index_t* gpr_proxy_index(char *segment); /* * Implementation of subscribe() */ int gpr_proxy_subscribe(ompi_registry_mode_t mode, - ompi_registry_action_t action, + ompi_registry_notify_action_t action, char *segment, char **tokens); /* diff --git a/src/mca/gpr/replica/Makefile.am b/src/mca/gpr/replica/Makefile.am index 8efc76650a..376d03bed8 100644 --- a/src/mca/gpr/replica/Makefile.am +++ b/src/mca/gpr/replica/Makefile.am @@ -7,9 +7,5 @@ include $(top_ompi_srcdir)/config/Makefile.options noinst_LTLIBRARIES = libmca_gpr_replica.la libmca_gpr_replica_la_SOURCES = \ gpr_replica.h \ - gpr_replica_internals.h \ gpr_replica.c \ - gpr_replica_component.c \ - gpr_replica_internals.c \ - gpr_replica_module.c - + gpr_replica_component.c diff --git a/src/mca/gpr/replica/gpr_replica.h b/src/mca/gpr/replica/gpr_replica.h index b468ef9912..4686834acc 100644 --- a/src/mca/gpr/replica/gpr_replica.h +++ b/src/mca/gpr/replica/gpr_replica.h @@ -170,8 +170,8 @@ int mca_gpr_replica_finalize(void); int gpr_replica_define_segment(char *segment); int gpr_replica_delete_segment(char *segment); int gpr_replica_put(ompi_registry_mode_t mode, char *segment, - char **tokens, mca_gpr_buffer_t *object, - mca_gpr_buffer_size_t size); + char **tokens, ompi_registry_object_t *object, + ompi_registry_object_size_t size); int gpr_replica_delete(ompi_registry_mode_t mode, char *segment, char **tokens); ompi_registry_index_t* gpr_replica_index(char *segment); diff --git a/src/mca/gpr/replica/gpr_replica_component.c b/src/mca/gpr/replica/gpr_replica_component.c index a4fce9a08b..02f0e81e61 100644 --- a/src/mca/gpr/replica/gpr_replica_component.c +++ b/src/mca/gpr/replica/gpr_replica_component.c @@ -20,7 +20,6 @@ #include "mca/oob/base/base.h" #include "mca/gpr/base/base.h" #include "gpr_replica.h" -#include "gpr_replica_internals.h" /* @@ -226,6 +225,8 @@ int mca_gpr_replica_close(void) mca_gpr_base_module_t *mca_gpr_replica_init(bool *allow_multi_user_threads, bool *have_hidden_threads, int *priority) { + /* ompi_registry_segment_t *seg; */ + /* If we're the seed, then we want to be selected, so do all the setup and return the module */ @@ -253,15 +254,15 @@ mca_gpr_base_module_t *mca_gpr_replica_init(bool *allow_multi_user_threads, bool mca_gpr_head.lastkey = 0; /* define the "universe" segment key */ - if (0 == gpr_replica_definekey("universe", NULL)) { + /* if (0 == gpr_replica_definekey("universe", NULL)) { ompi_output(0, "registry_init(error): could not create universe dictionary entry\n"); exit(OMPI_ERROR); } - + */ /* initialize the "universe" segment */ - seg = OBJ_NEW(ompi_registry_segment_t); /* allocate a new segment */ + /* seg = OBJ_NEW(ompi_registry_segment_t); seg->segment = gpr_replica_getkey("universe", NULL); - ompi_list_append(&mca_gpr_head.registry, &seg->item); /* add to the global registry */ + ompi_list_append(&mca_gpr_head.registry, &seg->item); */ /* Return the module */