From 8e48a8311e4f03adedc462ad6f01f781ee037b1f Mon Sep 17 00:00:00 2001 From: Ralph Castain Date: Mon, 12 Jul 2004 20:35:19 +0000 Subject: [PATCH] Provide new bit mask for ALL comparisons, early inclusion of some oob interfaces (but not working yet, just compiling). This commit was SVN r1641. --- src/mca/ns/ns.h | 22 ++++++++++++++++++ src/mca/ns/proxy/src/ns_proxy.c | 25 +++++++++++++++++++-- src/mca/ns/proxy/src/ns_proxy.h | 7 ++++++ src/mca/ns/proxy/src/ns_proxy_module.c | 10 +++++++++ src/mca/ns/replica/src/ns_replica.h | 9 ++++++++ src/mca/ns/replica/src/ns_replica_module.c | 26 ++++++++++++++++++++++ 6 files changed, 97 insertions(+), 2 deletions(-) diff --git a/src/mca/ns/ns.h b/src/mca/ns/ns.h index fb2eeea9b1..a56a25e9ac 100644 --- a/src/mca/ns/ns.h +++ b/src/mca/ns/ns.h @@ -56,6 +56,28 @@ typedef struct ompi_process_name_t ompi_process_name_t; /* declare the class */ OBJ_CLASS_DECLARATION(ompi_process_name_t); +/* + * define the command names/ids for use in OOB buffers. + * only needed for remotely executed commands. + */ +#define OMPI_NS_CREATE_CELLID 0x01 +#define OMPI_NS_CREATE_JOBID 0x02 +#define OMPI_NS_RESERVE_RANGE 0x04 +#define OMPI_NS_FREE_NAME 0x08 + +typedef uint8_t ompi_ns_cmd_bitmask_t; + +/* + * define the actual name server message buffer + */ + +struct ompi_ns_msg_buffer_t { + ompi_ns_cmd_bitmask_t command; + int buflen; + uint8_t *buf; +}; +typedef struct ompi_ns_msg_buffer_t ompi_ns_msg_buffer_t; + /* * Component functions - all MUST be provided! */ diff --git a/src/mca/ns/proxy/src/ns_proxy.c b/src/mca/ns/proxy/src/ns_proxy.c index b91e9f4a40..6bea4f2104 100644 --- a/src/mca/ns/proxy/src/ns_proxy.c +++ b/src/mca/ns/proxy/src/ns_proxy.c @@ -7,6 +7,7 @@ #include "ompi_config.h" #include "mca/mca.h" +#include "mca/oob/base/base.h" #include "mca/ns/base/base.h" #include "ns_proxy.h" @@ -20,8 +21,28 @@ ompi_process_id_t ns_proxy_create_cellid(void) { - /* JMS fill in here */ - return 1; + ompi_ns_msg_buffer_t cmd, *answer; + struct iovec msg; + ompi_process_id_t cell; + + cmd.command = OMPI_NS_CREATE_CELLID; + cmd.buflen = 0; + cmd.buf = NULL; + + msg.iov_base = (char*)&cmd; + msg.iov_len = sizeof(cmd); + + if (0 > mca_oob_send(&mca_ns_my_replica, &msg, 1, 0)) { /* error on send */ + return 0; + } + + if (0 > mca_oob_recv(&mca_ns_my_replica, &msg, 1, 0)) { /* error on recv */ + return 0; + } + + answer = (ompi_ns_msg_buffer_t*)msg.iov_base; + cell = (ompi_process_id_t)answer->buf; + return cell; } ompi_process_id_t ns_proxy_create_jobid(void) diff --git a/src/mca/ns/proxy/src/ns_proxy.h b/src/mca/ns/proxy/src/ns_proxy.h index 260570eeb9..50aba222d5 100644 --- a/src/mca/ns/proxy/src/ns_proxy.h +++ b/src/mca/ns/proxy/src/ns_proxy.h @@ -26,6 +26,13 @@ int mca_ns_proxy_close(void); mca_ns_t* mca_ns_proxy_init(bool *allow_multi_user_threads, bool *have_hidden_threads, int *priority); int mca_ns_proxy_finalize(void); +/* + * globals used within proxy component + */ + +extern ompi_process_name_t mca_ns_my_replica; + + /* * Implementation of create_cellid(). */ diff --git a/src/mca/ns/proxy/src/ns_proxy_module.c b/src/mca/ns/proxy/src/ns_proxy_module.c index 5638cee098..4cf1894336 100644 --- a/src/mca/ns/proxy/src/ns_proxy_module.c +++ b/src/mca/ns/proxy/src/ns_proxy_module.c @@ -70,6 +70,11 @@ static mca_ns_t mca_ns_proxy = { */ static bool initialized = false; +/* + * globals needed within proxy component + */ +ompi_process_name_t mca_ns_my_replica; + /* * don't really need this function - could just put NULL in the above structure @@ -107,6 +112,11 @@ mca_ns_t* mca_ns_proxy_init(bool *allow_multi_user_threads, bool *have_hidden_th *allow_multi_user_threads = true; *have_hidden_threads = false; + /* define the replica for us to use - for now, use only the seed */ + mca_ns_my_replica.cellid = 0; + mca_ns_my_replica.jobid = 0; + mca_ns_my_replica.vpid = 0; + /* Return the module */ initialized = true; diff --git a/src/mca/ns/replica/src/ns_replica.h b/src/mca/ns/replica/src/ns_replica.h index 1b47060e16..49bb7013a0 100644 --- a/src/mca/ns/replica/src/ns_replica.h +++ b/src/mca/ns/replica/src/ns_replica.h @@ -11,6 +11,7 @@ #include "include/types.h" #include "include/constants.h" #include "class/ompi_list.h" +#include "mca/oob/oob.h" #include "mca/ns/ns.h" /* @@ -47,6 +48,14 @@ int mca_ns_replica_close(void); mca_ns_t* mca_ns_replica_init(bool *allow_multi_user_threads, bool *have_hidden_threads, int *priority); int mca_ns_replica_finalize(void); +/* + * oob interface + */ + +mca_oob_callback_fn_t mca_ns_replica_recv(int status, const ompi_process_name_t *sender, + const struct iovec *msg, size_t count, + void *cbdata); + /* * Implementation of create_cellid(). */ diff --git a/src/mca/ns/replica/src/ns_replica_module.c b/src/mca/ns/replica/src/ns_replica_module.c index 2fe54e152e..7c1b655896 100644 --- a/src/mca/ns/replica/src/ns_replica_module.c +++ b/src/mca/ns/replica/src/ns_replica_module.c @@ -21,6 +21,7 @@ #include "util/proc_info.h" #include "util/output.h" #include "mca/mca.h" +#include "mca/oob/base/base.h" #include "mca/ns/base/base.h" #include "ns_replica.h" @@ -166,3 +167,28 @@ int mca_ns_replica_finalize(void) return OMPI_SUCCESS; } + +mca_oob_callback_fn_t mca_ns_replica_recv(int status, const ompi_process_name_t *sender, + const struct iovec *msg, size_t count, + void *cbdata) +{ + ompi_ns_msg_buffer_t *cmd, answer; + ompi_process_id_t tmp1; + struct iovec reply; + int i; + + for (i=0; iiov_base; + if (OMPI_NS_CREATE_CELLID == cmd->command) { /* got create_cellid command */ + tmp1 = ompi_name_server.create_cellid(); + answer.command = cmd->command; + answer.buflen = sizeof(tmp1); + answer.buf = (uint8_t*)&tmp1; + + reply.iov_base = (char*)&answer; + reply.iov_len = sizeof(answer); + mca_oob_send(sender, &reply, 1, 0); + } + } + return OMPI_SUCCESS; +}