Provide new bit mask for ALL comparisons, early inclusion of some oob interfaces (but not working yet, just compiling).
This commit was SVN r1641.
Этот коммит содержится в:
родитель
c232db97fe
Коммит
8e48a8311e
@ -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!
|
||||
*/
|
||||
|
@ -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)
|
||||
|
@ -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().
|
||||
*/
|
||||
|
@ -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;
|
||||
|
@ -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().
|
||||
*/
|
||||
|
@ -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; i<count; i++) { /* loop through all included commands */
|
||||
cmd = (ompi_ns_msg_buffer_t*)msg->iov_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;
|
||||
}
|
||||
|
Загрузка…
Ссылка в новой задаче
Block a user