Add a new interface function to the name server that returns the highest vpid allocated to a given job. This lets the caller determine how many vpids have been allocated to the job since vpids are always allocated contiguously.
Also, blow away a static-components.h file that accidentally got committed - should only be locally generated. This commit was SVN r3918.
Этот коммит содержится в:
родитель
b349d0ebcf
Коммит
bc6973cb02
@ -1,10 +0,0 @@
|
||||
/*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
|
||||
|
||||
const mca_base_component_t *mca_iof_base_static_components[] = {
|
||||
|
||||
NULL
|
||||
};
|
@ -106,12 +106,6 @@ OMPI_DECLSPEC int mca_ns_base_pack_jobid(void *dest, void *src, int n);
|
||||
|
||||
OMPI_DECLSPEC int mca_ns_base_unpack_jobid(void *dest, void *src, int n);
|
||||
|
||||
OMPI_DECLSPEC mca_ns_base_cellid_t mca_ns_base_create_cellid(void);
|
||||
|
||||
OMPI_DECLSPEC mca_ns_base_jobid_t mca_ns_base_create_jobid(void);
|
||||
|
||||
OMPI_DECLSPEC mca_ns_base_vpid_t mca_ns_base_reserve_range(mca_ns_base_jobid_t job, mca_ns_base_vpid_t range);
|
||||
|
||||
OMPI_DECLSPEC int mca_ns_base_free_name(ompi_process_name_t* name);
|
||||
|
||||
OMPI_DECLSPEC mca_ns_base_cellid_t mca_ns_base_create_cellid_not_available(void);
|
||||
@ -123,6 +117,7 @@ OMPI_DECLSPEC mca_ns_base_vpid_t mca_ns_base_get_vpid_range_not_available(mca
|
||||
|
||||
OMPI_DECLSPEC mca_ns_base_vpid_t mca_ns_base_derive_vpid(mca_ns_base_vpid_t base_vpid, int offset);
|
||||
|
||||
OMPI_DECLSPEC mca_ns_base_vpid_t mca_ns_base_get_allocated_vpids_not_available(mca_ns_base_jobid_t jobid);
|
||||
|
||||
/*
|
||||
* globals that might be needed
|
||||
|
@ -58,6 +58,11 @@ mca_ns_base_get_vpid_range_not_available(mca_ns_base_jobid_t job,
|
||||
return MCA_NS_BASE_VPID_MAX;
|
||||
}
|
||||
|
||||
mca_ns_base_vpid_t
|
||||
mca_ns_base_get_allocated_vpids_not_available(mca_ns_base_jobid_t jobid)
|
||||
{
|
||||
return MCA_NS_BASE_VPID_MAX;
|
||||
}
|
||||
|
||||
/*
|
||||
* functions
|
||||
|
@ -68,7 +68,9 @@ mca_ns_base_module_t ompi_name_server = {
|
||||
mca_ns_base_pack_cellid,
|
||||
mca_ns_base_unpack_cellid,
|
||||
mca_ns_base_pack_jobid,
|
||||
mca_ns_base_unpack_jobid
|
||||
mca_ns_base_unpack_jobid,
|
||||
mca_ns_base_derive_vpid,
|
||||
mca_ns_base_get_allocated_vpids_not_available
|
||||
};
|
||||
bool mca_ns_base_selected = false;
|
||||
ompi_list_t mca_ns_base_components_available;
|
||||
|
@ -63,8 +63,7 @@
|
||||
#define MCA_NS_CREATE_CELLID_CMD 0x01
|
||||
#define MCA_NS_CREATE_JOBID_CMD 0x02
|
||||
#define MCA_NS_RESERVE_RANGE_CMD 0x04
|
||||
#define MCA_NS_FREE_NAME_CMD 0x08
|
||||
#define MCA_NS_GET_MY_CELLID_CMD 0x10
|
||||
#define MCA_NS_GET_ALLOC_VPIDS_CMD 0x08
|
||||
#define MCA_NS_ERROR 0xff
|
||||
|
||||
|
||||
@ -101,19 +100,6 @@ struct ompi_process_name_t {
|
||||
typedef struct ompi_process_name_t 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
|
||||
#define OMPI_NS_GET_MY_CELLID 0x10
|
||||
|
||||
typedef uint8_t ompi_ns_cmd_bitmask_t;
|
||||
|
||||
|
||||
/*
|
||||
* Component functions - all MUST be provided!
|
||||
*/
|
||||
@ -700,7 +686,24 @@ typedef int (*mca_ns_base_module_pack_jobid_fn_t)(void *dest, void *src, int n);
|
||||
*/
|
||||
typedef int (*mca_ns_base_module_unpack_jobid_fn_t)(void *dest, void *src, int n);
|
||||
|
||||
|
||||
/*
|
||||
* Report what vpid's have been allocated
|
||||
* Given a jobid, return the end of the currently allocated vpid range. It is assumed
|
||||
* that all vpids up to and including the returned value have been allocated. However,
|
||||
* the name server cannot guarantee that any or all of these vpids are actually in
|
||||
* operation or have been "spawned".
|
||||
*
|
||||
* @param jobid The jobid for which the vpid information is requested.
|
||||
* @retval vpid The last vpid that was allocated. Since vpids are allocated on a
|
||||
* contiguous basis starting at zero, the caller can assume that all vpids less than
|
||||
* and including this number have been allocated.
|
||||
* @retval MCA_NS_BASE_VPID_MAX Error condition - value could not be returned for some reason.
|
||||
*
|
||||
* @code
|
||||
* vpid = ompi_name_server.allocated_vpids(jobid)
|
||||
* @endcode
|
||||
*/
|
||||
typedef mca_ns_base_vpid_t (*mca_ns_base_module_get_allocated_vpids_fn_t)(mca_ns_base_jobid_t jobid);
|
||||
|
||||
/*
|
||||
* Ver 1.0.0
|
||||
@ -735,6 +738,7 @@ struct mca_ns_base_module_1_0_0_t {
|
||||
mca_ns_base_module_pack_jobid_fn_t pack_jobid;
|
||||
mca_ns_base_module_unpack_jobid_fn_t unpack_jobid;
|
||||
mca_ns_base_module_derive_vpid_fn_t derive_vpid;
|
||||
mca_ns_base_module_get_allocated_vpids_fn_t get_allocated_vpids;
|
||||
};
|
||||
|
||||
typedef struct mca_ns_base_module_1_0_0_t mca_ns_base_module_1_0_0_t;
|
||||
|
@ -117,7 +117,8 @@ mca_ns_base_jobid_t mca_ns_proxy_create_jobid(void)
|
||||
}
|
||||
|
||||
|
||||
mca_ns_base_vpid_t mca_ns_proxy_reserve_range(mca_ns_base_jobid_t job, mca_ns_base_vpid_t range)
|
||||
mca_ns_base_vpid_t
|
||||
mca_ns_proxy_reserve_range(mca_ns_base_jobid_t job, mca_ns_base_vpid_t range)
|
||||
{
|
||||
ompi_buffer_t cmd;
|
||||
mca_ns_base_vpid_t starting_vpid;
|
||||
@ -166,3 +167,50 @@ mca_ns_base_vpid_t mca_ns_proxy_reserve_range(mca_ns_base_jobid_t job, mca_ns_ba
|
||||
return starting_vpid;
|
||||
}
|
||||
}
|
||||
|
||||
mca_ns_base_vpid_t
|
||||
mca_ns_proxy_get_allocated_vpids(mca_ns_base_jobid_t job)
|
||||
{
|
||||
ompi_buffer_t cmd;
|
||||
mca_ns_base_vpid_t vpid;
|
||||
ompi_buffer_t answer;
|
||||
mca_ns_cmd_flag_t command;
|
||||
int recv_tag;
|
||||
|
||||
command = MCA_NS_GET_ALLOC_VPIDS_CMD;
|
||||
recv_tag = MCA_OOB_TAG_NS;
|
||||
|
||||
if (OMPI_SUCCESS != ompi_buffer_init(&cmd, 0)) { /* got a problem */
|
||||
return OMPI_ERROR;
|
||||
}
|
||||
|
||||
if (OMPI_SUCCESS != ompi_pack(cmd, (void*)&command, 1, MCA_NS_OOB_PACK_CMD)) { /* got a problem */
|
||||
return OMPI_ERROR;
|
||||
}
|
||||
|
||||
if (OMPI_SUCCESS != ompi_pack(cmd, (void*)&job, 1, MCA_NS_OOB_PACK_JOBID)) { /* got a problem */
|
||||
return OMPI_ERROR;
|
||||
}
|
||||
|
||||
if (0 > mca_oob_send_packed(mca_ns_my_replica, cmd, MCA_OOB_TAG_NS, 0)) {
|
||||
return MCA_NS_BASE_VPID_MAX;
|
||||
}
|
||||
|
||||
if (0 > mca_oob_recv_packed(mca_ns_my_replica, &answer, &recv_tag)) {
|
||||
return MCA_NS_BASE_VPID_MAX;
|
||||
}
|
||||
|
||||
if ((OMPI_SUCCESS != ompi_unpack(answer, &command, 1, MCA_NS_OOB_PACK_CMD))
|
||||
|| (MCA_NS_GET_ALLOC_VPIDS_CMD != command)) {
|
||||
ompi_buffer_free(answer);
|
||||
return MCA_NS_BASE_VPID_MAX;
|
||||
}
|
||||
|
||||
if (OMPI_SUCCESS != ompi_unpack(answer, &vpid, 1, MCA_NS_OOB_PACK_VPID)) {
|
||||
ompi_buffer_free(answer);
|
||||
return MCA_NS_BASE_VPID_MAX;
|
||||
} else {
|
||||
ompi_buffer_free(answer);
|
||||
return vpid;
|
||||
}
|
||||
}
|
||||
|
@ -54,6 +54,7 @@ mca_ns_base_jobid_t mca_ns_proxy_create_jobid(void);
|
||||
|
||||
mca_ns_base_vpid_t mca_ns_proxy_reserve_range(mca_ns_base_jobid_t job, mca_ns_base_vpid_t range);
|
||||
|
||||
mca_ns_base_vpid_t mca_ns_proxy_get_allocated_vpids(mca_ns_base_jobid_t jobid);
|
||||
|
||||
#if defined(c_plusplus) || defined(__cplusplus)
|
||||
}
|
||||
|
@ -89,7 +89,8 @@ static mca_ns_base_module_t mca_ns_proxy = {
|
||||
mca_ns_base_unpack_cellid,
|
||||
mca_ns_base_pack_jobid,
|
||||
mca_ns_base_unpack_jobid,
|
||||
mca_ns_base_derive_vpid
|
||||
mca_ns_base_derive_vpid,
|
||||
mca_ns_proxy_get_allocated_vpids
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -67,7 +67,8 @@ mca_ns_base_jobid_t mca_ns_replica_create_jobid(void)
|
||||
}
|
||||
|
||||
|
||||
mca_ns_base_vpid_t mca_ns_replica_reserve_range(mca_ns_base_jobid_t job, mca_ns_base_vpid_t range)
|
||||
mca_ns_base_vpid_t
|
||||
mca_ns_replica_reserve_range(mca_ns_base_jobid_t job, mca_ns_base_vpid_t range)
|
||||
{
|
||||
mca_ns_replica_name_tracker_t *ptr;
|
||||
mca_ns_base_vpid_t start;
|
||||
@ -92,3 +93,21 @@ mca_ns_base_vpid_t mca_ns_replica_reserve_range(mca_ns_base_jobid_t job, mca_ns_
|
||||
OMPI_THREAD_UNLOCK(&mca_ns_replica_mutex);
|
||||
return MCA_NS_BASE_VPID_MAX;
|
||||
}
|
||||
|
||||
mca_ns_base_vpid_t
|
||||
mca_ns_replica_get_allocated_vpids(mca_ns_base_jobid_t job)
|
||||
{
|
||||
mca_ns_replica_name_tracker_t *ptr;
|
||||
|
||||
OMPI_THREAD_LOCK(&mca_ns_replica_mutex);
|
||||
|
||||
for (ptr = (mca_ns_replica_name_tracker_t*)ompi_list_get_first(&mca_ns_replica_name_tracker);
|
||||
ptr != (mca_ns_replica_name_tracker_t*)ompi_list_get_end(&mca_ns_replica_name_tracker);
|
||||
ptr = (mca_ns_replica_name_tracker_t*)ompi_list_get_next(ptr)) {
|
||||
if (job == ptr->job) { /* found the specified job */
|
||||
return ptr->last_used_vpid;
|
||||
}
|
||||
}
|
||||
OMPI_THREAD_UNLOCK(&mca_ns_replica_mutex);
|
||||
return MCA_NS_BASE_VPID_MAX;
|
||||
}
|
||||
|
@ -86,6 +86,11 @@ mca_ns_base_vpid_t mca_ns_replica_reserve_range(
|
||||
mca_ns_base_jobid_t job,
|
||||
mca_ns_base_vpid_t range);
|
||||
|
||||
/*
|
||||
* Implementation of get_allocated_vpids()
|
||||
*/
|
||||
mca_ns_base_vpid_t mca_ns_replica_get_allocated_vpids(mca_ns_base_jobid_t jobid);
|
||||
|
||||
#if defined(c_plusplus) || defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
@ -91,7 +91,8 @@ static mca_ns_base_module_t mca_ns_replica = {
|
||||
mca_ns_base_unpack_cellid,
|
||||
mca_ns_base_pack_jobid,
|
||||
mca_ns_base_unpack_jobid,
|
||||
mca_ns_base_derive_vpid
|
||||
mca_ns_base_derive_vpid,
|
||||
mca_ns_replica_get_allocated_vpids
|
||||
};
|
||||
|
||||
/*
|
||||
@ -240,56 +241,88 @@ void mca_ns_replica_recv(int status, ompi_process_name_t* sender,
|
||||
/* RHC -- not sure what to do if this fails */
|
||||
}
|
||||
|
||||
if (MCA_NS_CREATE_CELLID_CMD == command) { /* got a command to create a cellid */
|
||||
if (OMPI_SUCCESS != ompi_pack(answer, (void*)&command, 1, MCA_NS_OOB_PACK_CMD)) {
|
||||
goto RETURN_ERROR;
|
||||
}
|
||||
cell = ompi_name_server.create_cellid();
|
||||
if (OMPI_SUCCESS != ompi_pack(answer, (void*)&cell, 1, MCA_NS_OOB_PACK_CELLID)) {
|
||||
goto RETURN_ERROR;
|
||||
}
|
||||
if (0 > mca_oob_send_packed(sender, answer, tag, 0)) {
|
||||
/* RHC -- not sure what to do if the return send fails */
|
||||
}
|
||||
} else if (MCA_NS_CREATE_JOBID_CMD == command) { /* got command to create jobid */
|
||||
if (OMPI_SUCCESS != ompi_pack(answer, (void*)&command, 1, MCA_NS_OOB_PACK_CMD)) {
|
||||
goto RETURN_ERROR;
|
||||
}
|
||||
job = ompi_name_server.create_jobid();
|
||||
if (OMPI_SUCCESS != ompi_pack(answer, (void*)&job, 1, MCA_NS_OOB_PACK_JOBID)) {
|
||||
goto RETURN_ERROR;
|
||||
}
|
||||
if (0 > mca_oob_send_packed(sender, answer, tag, 0)) {
|
||||
/* RHC -- not sure what to do if the return send fails */
|
||||
}
|
||||
} else if (MCA_NS_RESERVE_RANGE_CMD == command) { /* got command to reserve vpid range */
|
||||
if (OMPI_SUCCESS != ompi_unpack(buffer, (void*)&job, 1, MCA_NS_OOB_PACK_JOBID)) {
|
||||
goto RETURN_ERROR;
|
||||
}
|
||||
switch(command) {
|
||||
|
||||
/***** CREATE_CELLID *****/
|
||||
case MCA_NS_CREATE_CELLID_CMD:
|
||||
if (OMPI_SUCCESS != ompi_pack(answer, (void*)&command, 1, MCA_NS_OOB_PACK_CMD)) {
|
||||
goto RETURN_ERROR;
|
||||
}
|
||||
cell = ompi_name_server.create_cellid();
|
||||
if (OMPI_SUCCESS != ompi_pack(answer, (void*)&cell, 1, MCA_NS_OOB_PACK_CELLID)) {
|
||||
goto RETURN_ERROR;
|
||||
}
|
||||
if (0 > mca_oob_send_packed(sender, answer, tag, 0)) {
|
||||
/* RHC -- not sure what to do if the return send fails */
|
||||
}
|
||||
break;
|
||||
|
||||
/***** CREATE_JOBID *****/
|
||||
case MCA_NS_CREATE_JOBID_CMD:
|
||||
if (OMPI_SUCCESS != ompi_pack(answer, (void*)&command, 1, MCA_NS_OOB_PACK_CMD)) {
|
||||
goto RETURN_ERROR;
|
||||
}
|
||||
job = ompi_name_server.create_jobid();
|
||||
if (OMPI_SUCCESS != ompi_pack(answer, (void*)&job, 1, MCA_NS_OOB_PACK_JOBID)) {
|
||||
goto RETURN_ERROR;
|
||||
}
|
||||
if (0 > mca_oob_send_packed(sender, answer, tag, 0)) {
|
||||
/* RHC -- not sure what to do if the return send fails */
|
||||
}
|
||||
break;
|
||||
|
||||
/***** RESERVE_RANGE *****/
|
||||
case MCA_NS_RESERVE_RANGE_CMD:
|
||||
if (OMPI_SUCCESS != ompi_unpack(buffer, (void*)&job, 1, MCA_NS_OOB_PACK_JOBID)) {
|
||||
goto RETURN_ERROR;
|
||||
}
|
||||
|
||||
if (OMPI_SUCCESS != ompi_unpack(buffer, (void*)&range, 1, MCA_NS_OOB_PACK_VPID)) {
|
||||
goto RETURN_ERROR;
|
||||
}
|
||||
|
||||
vpid = mca_ns_replica_reserve_range(job, range);
|
||||
if (OMPI_SUCCESS != ompi_pack(answer, (void*)&command, 1, MCA_NS_OOB_PACK_CMD)) {
|
||||
goto RETURN_ERROR;
|
||||
}
|
||||
|
||||
if (OMPI_SUCCESS != ompi_pack(answer, (void*)&vpid, 1, MCA_NS_OOB_PACK_VPID)) {
|
||||
goto RETURN_ERROR;
|
||||
}
|
||||
if (0 > mca_oob_send_packed(sender, answer, tag, 0)) {
|
||||
/* RHC -- not sure what to do if the return send fails */
|
||||
}
|
||||
ompi_buffer_free(answer);
|
||||
break;
|
||||
|
||||
/***** GET_ALLOCATED_VPIDS *****/
|
||||
case MCA_NS_GET_ALLOC_VPIDS_CMD:
|
||||
if (OMPI_SUCCESS != ompi_unpack(buffer, (void*)&job, 1, MCA_NS_OOB_PACK_JOBID)) {
|
||||
goto RETURN_ERROR;
|
||||
}
|
||||
|
||||
vpid = mca_ns_replica_get_allocated_vpids(job);
|
||||
if (OMPI_SUCCESS != ompi_pack(answer, (void*)&command, 1, MCA_NS_OOB_PACK_CMD)) {
|
||||
goto RETURN_ERROR;
|
||||
}
|
||||
|
||||
if (OMPI_SUCCESS != ompi_pack(answer, (void*)&vpid, 1, MCA_NS_OOB_PACK_VPID)) {
|
||||
goto RETURN_ERROR;
|
||||
}
|
||||
if (0 > mca_oob_send_packed(sender, answer, tag, 0)) {
|
||||
/* RHC -- not sure what to do if the return send fails */
|
||||
}
|
||||
ompi_buffer_free(answer);
|
||||
break;
|
||||
|
||||
if (OMPI_SUCCESS != ompi_unpack(buffer, (void*)&range, 1, MCA_NS_OOB_PACK_VPID)) {
|
||||
goto RETURN_ERROR;
|
||||
}
|
||||
|
||||
vpid = ompi_name_server.reserve_range(job, range);
|
||||
if (OMPI_SUCCESS != ompi_pack(answer, (void*)&command, 1, MCA_NS_OOB_PACK_CMD)) {
|
||||
goto RETURN_ERROR;
|
||||
}
|
||||
|
||||
if (OMPI_SUCCESS != ompi_pack(answer, (void*)&vpid, 1, MCA_NS_OOB_PACK_VPID)) {
|
||||
goto RETURN_ERROR;
|
||||
}
|
||||
if (0 > mca_oob_send_packed(sender, answer, tag, 0)) {
|
||||
/* RHC -- not sure what to do if the return send fails */
|
||||
}
|
||||
ompi_buffer_free(answer);
|
||||
} else { /* got an unrecognized command */
|
||||
RETURN_ERROR:
|
||||
ompi_buffer_init(&error_answer, 8);
|
||||
command = MCA_NS_ERROR;
|
||||
ompi_pack(error_answer, (void*)&command, 1, MCA_NS_OOB_PACK_CMD);
|
||||
mca_oob_send_packed(sender, error_answer, tag, 0);
|
||||
ompi_buffer_free(error_answer);
|
||||
/***** UNRECOGNIZED COMMAND *****/
|
||||
default:
|
||||
RETURN_ERROR:
|
||||
ompi_buffer_init(&error_answer, 8);
|
||||
command = MCA_NS_ERROR;
|
||||
ompi_pack(error_answer, (void*)&command, 1, MCA_NS_OOB_PACK_CMD);
|
||||
mca_oob_send_packed(sender, error_answer, tag, 0);
|
||||
ompi_buffer_free(error_answer);
|
||||
}
|
||||
|
||||
/* reissue the non-blocking receive */
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user