* reintroduce r1965, with change in ns_proxy_component so that functions
are in the right order in the process struct This commit was SVN r2006. The following SVN revision numbers were found above: r1965 --> open-mpi/ompi@48c8d55b6d
Этот коммит содержится в:
родитель
0216249ba5
Коммит
567c777904
@ -35,6 +35,8 @@ extern "C" {
|
|||||||
mca_ns_base_jobid_t job,
|
mca_ns_base_jobid_t job,
|
||||||
mca_ns_base_vpid_t vpid);
|
mca_ns_base_vpid_t vpid);
|
||||||
|
|
||||||
|
ompi_process_name_t* ns_base_convert_string_to_process_name(const char* name);
|
||||||
|
|
||||||
char* ns_base_get_proc_name_string(const ompi_process_name_t* name);
|
char* ns_base_get_proc_name_string(const ompi_process_name_t* name);
|
||||||
|
|
||||||
char* ns_base_get_vpid_string(const ompi_process_name_t* name);
|
char* ns_base_get_vpid_string(const ompi_process_name_t* name);
|
||||||
|
@ -28,6 +28,12 @@ ompi_process_name_t* ns_base_create_process_name(mca_ns_base_cellid_t cell,
|
|||||||
{
|
{
|
||||||
ompi_process_name_t *newname;
|
ompi_process_name_t *newname;
|
||||||
|
|
||||||
|
if (MCA_NS_BASE_CELLID_MAX < cell ||
|
||||||
|
MCA_NS_BASE_JOBID_MAX < job ||
|
||||||
|
MCA_NS_BASE_VPID_MAX < vpid) {
|
||||||
|
return(NULL);
|
||||||
|
}
|
||||||
|
|
||||||
newname = OBJ_NEW(ompi_process_name_t);
|
newname = OBJ_NEW(ompi_process_name_t);
|
||||||
if (NULL == newname) { /* got an error */
|
if (NULL == newname) { /* got an error */
|
||||||
return(NULL);
|
return(NULL);
|
||||||
@ -43,39 +49,97 @@ ompi_process_name_t* ns_base_create_process_name(mca_ns_base_cellid_t cell,
|
|||||||
char* ns_base_get_proc_name_string(const ompi_process_name_t* name)
|
char* ns_base_get_proc_name_string(const ompi_process_name_t* name)
|
||||||
{
|
{
|
||||||
char *name_string;
|
char *name_string;
|
||||||
int size;
|
|
||||||
|
|
||||||
if (NULL == name) { /* got an error */
|
if (NULL == name) { /* got an error */
|
||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
size = (3*sizeof(name->cellid)/4) + 3;
|
if (0 > asprintf(&name_string, "%0X.%0X.%0X", name->cellid, name->jobid, name->vpid)) {
|
||||||
name_string = (char*)malloc(27*sizeof(char));
|
return NULL;
|
||||||
if (NULL == name_string) { /* got an error */
|
|
||||||
return(NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sprintf(name_string, "%0x.%0x.%0x", name->cellid, name->jobid, name->vpid);
|
|
||||||
return(name_string);
|
return(name_string);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ompi_process_name_t* ns_base_convert_string_to_process_name(const char* name)
|
||||||
|
{
|
||||||
|
char *temp, *token;
|
||||||
|
mca_ns_base_cellid_t cell;
|
||||||
|
mca_ns_base_jobid_t job;
|
||||||
|
mca_ns_base_vpid_t vpid;
|
||||||
|
unsigned long int tmpint;
|
||||||
|
|
||||||
|
const char delimiters[] = ".";
|
||||||
|
ompi_process_name_t *return_code;
|
||||||
|
|
||||||
|
return_code = NULL;
|
||||||
|
|
||||||
|
/* check for NULL string - error */
|
||||||
|
if (NULL == name) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
temp = strdup(name);
|
||||||
|
token = strtok(temp, delimiters); /* get first field -> cellid */
|
||||||
|
|
||||||
|
/* convert to largest possible unsigned int - unsigned long long is only supported
|
||||||
|
* in C99, so we have to use unsigned long for backward compatibility - then
|
||||||
|
* check to ensure it is within range of cellid_t before casting */
|
||||||
|
|
||||||
|
tmpint = strtoul(token, NULL, 16);
|
||||||
|
if (MCA_NS_BASE_CELLID_MAX >= tmpint) {
|
||||||
|
cell = (mca_ns_base_cellid_t)tmpint;
|
||||||
|
} else {
|
||||||
|
goto CLEANUP;
|
||||||
|
}
|
||||||
|
|
||||||
|
token = strtok(NULL, delimiters); /* get second field -> jobid */
|
||||||
|
|
||||||
|
/* convert to largest possible unsigned int - then
|
||||||
|
* check to ensure it is within range of jobid_t before casting */
|
||||||
|
|
||||||
|
tmpint = strtoul(token, NULL, 16);
|
||||||
|
if (MCA_NS_BASE_JOBID_MAX >= tmpint) {
|
||||||
|
job = (mca_ns_base_jobid_t)tmpint;
|
||||||
|
} else {
|
||||||
|
goto CLEANUP;
|
||||||
|
}
|
||||||
|
|
||||||
|
token = strtok(NULL, delimiters); /* get third field -> vpid */
|
||||||
|
|
||||||
|
/* convert to largest possible unsigned int then
|
||||||
|
* check to ensure it is within range of vpid_t before casting */
|
||||||
|
|
||||||
|
tmpint = strtoul(token, NULL, 16);
|
||||||
|
if (MCA_NS_BASE_VPID_MAX >= tmpint) {
|
||||||
|
vpid = (mca_ns_base_vpid_t)tmpint;
|
||||||
|
} else {
|
||||||
|
goto CLEANUP;
|
||||||
|
}
|
||||||
|
|
||||||
|
return_code = ns_base_create_process_name(cell, job, vpid);
|
||||||
|
|
||||||
|
CLEANUP:
|
||||||
|
if (temp) {
|
||||||
|
free(temp);
|
||||||
|
}
|
||||||
|
|
||||||
|
return return_code;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
char* ns_base_get_vpid_string(const ompi_process_name_t* name)
|
char* ns_base_get_vpid_string(const ompi_process_name_t* name)
|
||||||
{
|
{
|
||||||
char *name_string;
|
char *name_string;
|
||||||
int size;
|
|
||||||
|
|
||||||
if (NULL == name) { /* got an error */
|
if (NULL == name) { /* got an error */
|
||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
size = 1 + sizeof(name->vpid)/4;
|
if (0 > asprintf(&name_string, "%0X", name->vpid)) {
|
||||||
name_string = (char*)malloc(size*sizeof(char));
|
return NULL;
|
||||||
if (NULL == name_string) { /* got an error */
|
|
||||||
return(NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sprintf(name_string, "%0x", name->vpid);
|
|
||||||
return(name_string);
|
return(name_string);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,19 +147,15 @@ char* ns_base_get_vpid_string(const ompi_process_name_t* name)
|
|||||||
char* ns_base_get_jobid_string(const ompi_process_name_t* name)
|
char* ns_base_get_jobid_string(const ompi_process_name_t* name)
|
||||||
{
|
{
|
||||||
char *name_string;
|
char *name_string;
|
||||||
int size;
|
|
||||||
|
|
||||||
if (NULL == name) { /* got an error */
|
if (NULL == name) { /* got an error */
|
||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
size = 1 + sizeof(name->jobid);
|
if (0 > asprintf(&name_string, "%0X", name->jobid)) {
|
||||||
name_string = (char*)malloc(size*sizeof(char));
|
return NULL;
|
||||||
if (NULL == name_string) { /* got an error */
|
|
||||||
return(NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sprintf(name_string, "%0x", name->jobid);
|
|
||||||
return(name_string);
|
return(name_string);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -103,19 +163,15 @@ char* ns_base_get_jobid_string(const ompi_process_name_t* name)
|
|||||||
char* ns_base_get_cellid_string(const ompi_process_name_t* name)
|
char* ns_base_get_cellid_string(const ompi_process_name_t* name)
|
||||||
{
|
{
|
||||||
char *name_string;
|
char *name_string;
|
||||||
int size;
|
|
||||||
|
|
||||||
if (NULL == name) { /* got an error */
|
if (NULL == name) { /* got an error */
|
||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
size = 1 + sizeof(name->cellid);
|
if (0 > asprintf(&name_string, "%0X", name->cellid)) {
|
||||||
name_string = (char*)malloc(size*sizeof(char));
|
return NULL;
|
||||||
if (NULL == name_string) { /* got an error */
|
|
||||||
return(NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sprintf(name_string, "%0x", name->cellid);
|
|
||||||
return(name_string);
|
return(name_string);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -123,7 +179,7 @@ char* ns_base_get_cellid_string(const ompi_process_name_t* name)
|
|||||||
mca_ns_base_vpid_t ns_base_get_vpid(const ompi_process_name_t* name)
|
mca_ns_base_vpid_t ns_base_get_vpid(const ompi_process_name_t* name)
|
||||||
{
|
{
|
||||||
if (NULL == name) { /* got an error */
|
if (NULL == name) { /* got an error */
|
||||||
return(OMPI_NAME_SERVICE_MAX);
|
return(MCA_NS_BASE_VPID_MAX);
|
||||||
}
|
}
|
||||||
|
|
||||||
return(name->vpid);
|
return(name->vpid);
|
||||||
@ -133,7 +189,7 @@ mca_ns_base_vpid_t ns_base_get_vpid(const ompi_process_name_t* name)
|
|||||||
mca_ns_base_jobid_t ns_base_get_jobid(const ompi_process_name_t* name)
|
mca_ns_base_jobid_t ns_base_get_jobid(const ompi_process_name_t* name)
|
||||||
{
|
{
|
||||||
if (NULL == name) { /* got an error */
|
if (NULL == name) { /* got an error */
|
||||||
return(OMPI_NAME_SERVICE_MAX);
|
return(MCA_NS_BASE_JOBID_MAX);
|
||||||
}
|
}
|
||||||
|
|
||||||
return(name->jobid);
|
return(name->jobid);
|
||||||
@ -142,7 +198,7 @@ mca_ns_base_jobid_t ns_base_get_jobid(const ompi_process_name_t* name)
|
|||||||
mca_ns_base_cellid_t ns_base_get_cellid(const ompi_process_name_t* name)
|
mca_ns_base_cellid_t ns_base_get_cellid(const ompi_process_name_t* name)
|
||||||
{
|
{
|
||||||
if (NULL == name) { /* got an error */
|
if (NULL == name) { /* got an error */
|
||||||
return(OMPI_NAME_SERVICE_MAX);
|
return(MCA_NS_BASE_CELLID_MAX);
|
||||||
}
|
}
|
||||||
|
|
||||||
return(name->cellid);
|
return(name->cellid);
|
||||||
|
@ -39,7 +39,9 @@
|
|||||||
/*
|
/*
|
||||||
* define maximum value for id's in any field
|
* define maximum value for id's in any field
|
||||||
*/
|
*/
|
||||||
#define OMPI_NAME_SERVICE_MAX UINT32_MAX
|
#define MCA_NS_BASE_CELLID_MAX UINT32_MAX
|
||||||
|
#define MCA_NS_BASE_JOBID_MAX UINT32_MAX
|
||||||
|
#define MCA_NS_BASE_VPID_MAX UINT32_MAX
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* general typedefs & structures
|
* general typedefs & structures
|
||||||
@ -90,14 +92,16 @@ typedef struct ompi_ns_msg_buffer_t ompi_ns_msg_buffer_t;
|
|||||||
* Create a new cell id.
|
* Create a new cell id.
|
||||||
* The create_cellid() function allocates a new cell id for use by the caller.
|
* The create_cellid() function allocates a new cell id for use by the caller.
|
||||||
* The function checks to find the next available cell id, reserves it, and returns that
|
* The function checks to find the next available cell id, reserves it, and returns that
|
||||||
* number. No memory for names is allocated by this process.
|
* number. No memory for names is allocated by this process. The range of answers is from
|
||||||
|
* 1 to MCA_NS_BASE_CELLID_MAX-1 (zero is reserved for the seed name and cannot therefore be
|
||||||
|
* allocated).
|
||||||
*
|
*
|
||||||
* @param None
|
* @param None
|
||||||
* @retval cellid The ompi_process_id_t value of the allocated cell id. There currently
|
* @retval cellid The numerical value of the allocated cell id. A value of
|
||||||
* is no error indication that a cell id could not be allocated - this represents a very unlikely
|
* MCA_NS_BASE_CELLID_MAX indicates
|
||||||
|
* that an error occurred - this represents a very unlikely
|
||||||
* event meaning that the system ran out of cell id's. This probably indicates
|
* event meaning that the system ran out of cell id's. This probably indicates
|
||||||
* an error in the calling program as the number of available cell id's is extremely large.
|
* an error in the calling program as the number of available cell id's is extremely large.
|
||||||
* Some means of returning a value indicative of an error will be devised in the future.
|
|
||||||
*
|
*
|
||||||
* @code
|
* @code
|
||||||
* new_cellid = ompi_name_server.create_cellid()
|
* new_cellid = ompi_name_server.create_cellid()
|
||||||
@ -109,18 +113,21 @@ typedef mca_ns_base_cellid_t (*mca_ns_base_module_create_cellid_fn_t)(void);
|
|||||||
* Create a new job id.
|
* Create a new job id.
|
||||||
* The create_jobid() function allocates a new job id for use by the caller.
|
* The create_jobid() function allocates a new job id for use by the caller.
|
||||||
* The function checks to find the next available job id, reserves it, and returns that
|
* The function checks to find the next available job id, reserves it, and returns that
|
||||||
* number. No memory for names is allocated by this process.
|
* number. No memory for names is allocated by this process. The range of answers is from
|
||||||
|
* 1 to MCA_NS_BASE_JOBID_MAX-1 (zero is reserved for the seed name and cannot therefore be
|
||||||
|
* allocated).
|
||||||
|
|
||||||
*
|
*
|
||||||
* The 0 job id is reserved for daemons within the system and will not be allocated.
|
* The 0 job id is reserved for daemons within the system and will not be allocated.
|
||||||
* Developers should therefore assume that the daemon job id is automatically allocated
|
* Developers should therefore assume that the daemon job id is automatically allocated
|
||||||
* and proceed to request names against it.
|
* and proceed to request names against it.
|
||||||
*
|
*
|
||||||
* @param None
|
* @param None
|
||||||
* @retval jobid The ompi_process_id_t value of the allocated job id. There currently
|
* @retval jobid The numerical value of the allocated job id. A value of
|
||||||
* is no error indication that a job id could not be allocated - this represents a very unlikely
|
* MCA_NS_BASE_JOBID_MAX indicates
|
||||||
|
* that an error occurred - this represents a very unlikely
|
||||||
* event meaning that the system ran out of job id's. This probably indicates
|
* event meaning that the system ran out of job id's. This probably indicates
|
||||||
* an error in the calling program as the number of available job id's is extremely large.
|
* an error in the calling program as the number of available job id's is extremely large.
|
||||||
* Some means of returning a value indicative of an error will be devised in the future.
|
|
||||||
*
|
*
|
||||||
* @code
|
* @code
|
||||||
* new_jobid = ompi_name_server.create_jobid()
|
* new_jobid = ompi_name_server.create_jobid()
|
||||||
@ -155,6 +162,25 @@ typedef mca_ns_base_jobid_t (*mca_ns_base_module_create_jobid_fn_t)(void);
|
|||||||
typedef ompi_process_name_t* (*mca_ns_base_module_create_proc_name_fn_t)(mca_ns_base_cellid_t cell, mca_ns_base_jobid_t job, mca_ns_base_vpid_t vpid);
|
typedef ompi_process_name_t* (*mca_ns_base_module_create_proc_name_fn_t)(mca_ns_base_cellid_t cell, mca_ns_base_jobid_t job, mca_ns_base_vpid_t vpid);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert a string representation to a process name.
|
||||||
|
* The convert_string_to_process_name() function converts a string representation of a process
|
||||||
|
* name into an Open MPI name structure. The string must be of the proper form - i.e., it
|
||||||
|
* must be in the form "cellid.jobid.vpid", where each field is expressed in hexadecimal form.
|
||||||
|
*
|
||||||
|
* @param *name_string A character string representation of a process name.
|
||||||
|
*
|
||||||
|
* @retval *name Pointer to an ompi_process_name_t structure containing the name.
|
||||||
|
* @retval NULL Indicates an error, probably due to inability to allocate memory for
|
||||||
|
* the name structure.
|
||||||
|
*
|
||||||
|
* @code
|
||||||
|
* name = ompi_name_server.convert_string_to_process_name(name_string);
|
||||||
|
* @endcode
|
||||||
|
*/
|
||||||
|
typedef ompi_process_name_t* (*mca_ns_base_module_convert_string_to_process_name_fn_t)(const char* name);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reserve a range of process id's.
|
* Reserve a range of process id's.
|
||||||
* The reserve_range() function reserves a range of vpid's for the given jobid.
|
* The reserve_range() function reserves a range of vpid's for the given jobid.
|
||||||
@ -166,9 +192,8 @@ typedef ompi_process_name_t* (*mca_ns_base_module_create_proc_name_fn_t)(mca_ns_
|
|||||||
* next available process id and assign range-number of sequential id's to the caller.
|
* next available process id and assign range-number of sequential id's to the caller.
|
||||||
* These id's will be reserved - i.e., they cannot be assigned to any subsequent caller.
|
* These id's will be reserved - i.e., they cannot be assigned to any subsequent caller.
|
||||||
*
|
*
|
||||||
* @retval startid The starting value of the reserved range of vpid's. At this time,
|
* @retval startid The starting value of the reserved range of vpid's. A value of MCA_NS_BASE_VPID_MAX
|
||||||
* no means for returning an error condition is available. This will be rectified in the
|
* indicates that an error occurred.
|
||||||
* near future.
|
|
||||||
*
|
*
|
||||||
* @code
|
* @code
|
||||||
* starting_procid = ompi_name_server.reserve_range(jobid, range)
|
* starting_procid = ompi_name_server.reserve_range(jobid, range)
|
||||||
@ -290,15 +315,15 @@ typedef char* (*mca_ns_base_module_get_jobid_string_fn_t)(const ompi_process_nam
|
|||||||
typedef char* (*mca_ns_base_module_get_cellid_string_fn_t)(const ompi_process_name_t *name);
|
typedef char* (*mca_ns_base_module_get_cellid_string_fn_t)(const ompi_process_name_t *name);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the virtual process id as an ompi_process_id_t value.
|
* Get the virtual process id as a numeric value.
|
||||||
* The get_vpid() function returns the vpid in an ompi_process_id_t representation -
|
* The get_vpid() function returns the vpid in a numeric representation -
|
||||||
* i.e., in an integer form.
|
* i.e., in an integer form.
|
||||||
*
|
*
|
||||||
* @param *name A pointer to the name structure containing the name.
|
* @param *name A pointer to the name structure containing the name.
|
||||||
*
|
*
|
||||||
* @retval vpid The vpid field of the provided name. There currently
|
* @retval vpid The vpid field of the provided name.
|
||||||
* is no error indication that this function failed.
|
* @retval MCA_NS_BASE_VPID_MAX Indicates that an error occurred - in this case, that
|
||||||
* Some means of returning a value indicative of an error will be devised in the future.
|
* the name variable provided was NULL.
|
||||||
*
|
*
|
||||||
* @code
|
* @code
|
||||||
* vpid = ompi_name_server.get_vpid(&name)
|
* vpid = ompi_name_server.get_vpid(&name)
|
||||||
@ -307,15 +332,15 @@ typedef char* (*mca_ns_base_module_get_cellid_string_fn_t)(const ompi_process_na
|
|||||||
typedef mca_ns_base_vpid_t (*mca_ns_base_module_get_vpid_fn_t)(const ompi_process_name_t *name);
|
typedef mca_ns_base_vpid_t (*mca_ns_base_module_get_vpid_fn_t)(const ompi_process_name_t *name);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the job id as an ompi_process_id_t value.
|
* Get the job id as a numeric value.
|
||||||
* The get_jobid() function returns the job id in an ompi_process_id_t representation -
|
* The get_jobid() function returns the job id in a numeric representation -
|
||||||
* i.e., in an integer form.
|
* i.e., in an integer form.
|
||||||
*
|
*
|
||||||
* @param *name A pointer to the name structure containing the name.
|
* @param *name A pointer to the name structure containing the name.
|
||||||
*
|
*
|
||||||
* @retval jobid The job id field of the provided name. There currently
|
* @retval jobid The job id field of the provided name.
|
||||||
* is no error indication that this function failed.
|
* @retval MCA_NS_BASE_JOBID_MAX Indicates that an error occurred - in this case, that
|
||||||
* Some means of returning a value indicative of an error will be devised in the future.
|
* the name variable provided was NULL.
|
||||||
*
|
*
|
||||||
* @code
|
* @code
|
||||||
* jobid = ompi_name_server.get_jobid(&name)
|
* jobid = ompi_name_server.get_jobid(&name)
|
||||||
@ -324,15 +349,15 @@ typedef mca_ns_base_vpid_t (*mca_ns_base_module_get_vpid_fn_t)(const ompi_proces
|
|||||||
typedef mca_ns_base_jobid_t (*mca_ns_base_module_get_jobid_fn_t)(const ompi_process_name_t *name);
|
typedef mca_ns_base_jobid_t (*mca_ns_base_module_get_jobid_fn_t)(const ompi_process_name_t *name);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the cell id as an ompi_process_id_t value.
|
* Get the cell id as a numberic value.
|
||||||
* The get_cellid() function returns the cell id in an ompi_process_id_t representation -
|
* The get_cellid() function returns the cell id in a numeric representation -
|
||||||
* i.e., in an integer form.
|
* i.e., in an integer form.
|
||||||
*
|
*
|
||||||
* @param *name A pointer to the name structure containing the name.
|
* @param *name A pointer to the name structure containing the name.
|
||||||
*
|
*
|
||||||
* @retval cellid The cell id field of the provided name. There currently
|
* @retval cellid The cell id field of the provided name.
|
||||||
* is no error indication that this function failed.
|
* @retval MCA_NS_BASE_CELLID_MAX Indicates that an error occurred - in this case, that
|
||||||
* Some means of returning a value indicative of an error will be devised in the future.
|
* the name variable provided was NULL.
|
||||||
*
|
*
|
||||||
* @code
|
* @code
|
||||||
* cellid = ompi_name_server.get_cellid(&name)
|
* cellid = ompi_name_server.get_cellid(&name)
|
||||||
@ -378,6 +403,7 @@ struct mca_ns_base_module_1_0_0_t {
|
|||||||
mca_ns_base_module_create_cellid_fn_t create_cellid;
|
mca_ns_base_module_create_cellid_fn_t create_cellid;
|
||||||
mca_ns_base_module_create_jobid_fn_t create_jobid;
|
mca_ns_base_module_create_jobid_fn_t create_jobid;
|
||||||
mca_ns_base_module_create_proc_name_fn_t create_process_name;
|
mca_ns_base_module_create_proc_name_fn_t create_process_name;
|
||||||
|
mca_ns_base_module_convert_string_to_process_name_fn_t convert_string_to_process_name;
|
||||||
mca_ns_base_module_reserve_range_fn_t reserve_range;
|
mca_ns_base_module_reserve_range_fn_t reserve_range;
|
||||||
mca_ns_base_module_free_name_fn_t free_name;
|
mca_ns_base_module_free_name_fn_t free_name;
|
||||||
mca_ns_base_module_get_proc_name_string_fn_t get_proc_name_string;
|
mca_ns_base_module_get_proc_name_string_fn_t get_proc_name_string;
|
||||||
|
@ -53,6 +53,7 @@ static mca_ns_base_module_t mca_ns_proxy = {
|
|||||||
ns_base_create_cellid,
|
ns_base_create_cellid,
|
||||||
ns_base_create_jobid,
|
ns_base_create_jobid,
|
||||||
ns_base_create_process_name,
|
ns_base_create_process_name,
|
||||||
|
ns_base_convert_string_to_process_name,
|
||||||
ns_base_reserve_range,
|
ns_base_reserve_range,
|
||||||
ns_base_free_name,
|
ns_base_free_name,
|
||||||
ns_base_get_proc_name_string,
|
ns_base_get_proc_name_string,
|
||||||
|
@ -22,11 +22,11 @@
|
|||||||
|
|
||||||
mca_ns_base_cellid_t ns_replica_create_cellid(void)
|
mca_ns_base_cellid_t ns_replica_create_cellid(void)
|
||||||
{
|
{
|
||||||
if ((OMPI_NAME_SERVICE_MAX-1) >= mca_ns_replica_last_used_cellid) {
|
if ((MCA_NS_BASE_CELLID_MAX-2) >= mca_ns_replica_last_used_cellid) {
|
||||||
mca_ns_replica_last_used_cellid = mca_ns_replica_last_used_cellid + 1;
|
mca_ns_replica_last_used_cellid = mca_ns_replica_last_used_cellid + 1;
|
||||||
return(mca_ns_replica_last_used_cellid);
|
return(mca_ns_replica_last_used_cellid);
|
||||||
} else {
|
} else {
|
||||||
return(0);
|
return MCA_NS_BASE_CELLID_MAX;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -34,7 +34,7 @@ mca_ns_base_jobid_t ns_replica_create_jobid(void)
|
|||||||
{
|
{
|
||||||
mca_ns_replica_name_tracker_t *new;
|
mca_ns_replica_name_tracker_t *new;
|
||||||
|
|
||||||
if ((OMPI_NAME_SERVICE_MAX-1) >= mca_ns_replica_last_used_jobid) {
|
if ((MCA_NS_BASE_JOBID_MAX-2) >= mca_ns_replica_last_used_jobid) {
|
||||||
mca_ns_replica_last_used_jobid = mca_ns_replica_last_used_jobid + 1;
|
mca_ns_replica_last_used_jobid = mca_ns_replica_last_used_jobid + 1;
|
||||||
new = OBJ_NEW(mca_ns_replica_name_tracker_t);
|
new = OBJ_NEW(mca_ns_replica_name_tracker_t);
|
||||||
new->job = mca_ns_replica_last_used_jobid;
|
new->job = mca_ns_replica_last_used_jobid;
|
||||||
@ -42,7 +42,7 @@ mca_ns_base_jobid_t ns_replica_create_jobid(void)
|
|||||||
ompi_list_append(&mca_ns_replica_name_tracker, &new->item);
|
ompi_list_append(&mca_ns_replica_name_tracker, &new->item);
|
||||||
return(mca_ns_replica_last_used_jobid);
|
return(mca_ns_replica_last_used_jobid);
|
||||||
} else {
|
} else {
|
||||||
return(0);
|
return MCA_NS_BASE_JOBID_MAX;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -56,14 +56,14 @@ mca_ns_base_vpid_t ns_replica_reserve_range(mca_ns_base_jobid_t job, mca_ns_base
|
|||||||
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_end(&mca_ns_replica_name_tracker);
|
||||||
ptr = (mca_ns_replica_name_tracker_t*)ompi_list_get_next(ptr)) {
|
ptr = (mca_ns_replica_name_tracker_t*)ompi_list_get_next(ptr)) {
|
||||||
if (job == ptr->job) { /* found the specified job */
|
if (job == ptr->job) { /* found the specified job */
|
||||||
if ((OMPI_NAME_SERVICE_MAX-range-1) >= ptr->last_used_vpid) { /* requested range available */
|
if ((MCA_NS_BASE_VPID_MAX-range-2) >= ptr->last_used_vpid) { /* requested range available */
|
||||||
start = ptr->last_used_vpid + 1;
|
start = ptr->last_used_vpid + 1;
|
||||||
ptr->last_used_vpid = ptr->last_used_vpid + range;
|
ptr->last_used_vpid = ptr->last_used_vpid + range;
|
||||||
return(start);
|
return(start);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return(0);
|
return MCA_NS_BASE_VPID_MAX;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
#ifndef NS_REPLICA_H
|
#ifndef NS_REPLICA_H
|
||||||
#define NS_REPLICA_H
|
#define NS_REPLICA_H
|
||||||
|
|
||||||
|
#include <pthread.h>
|
||||||
|
|
||||||
#include "ompi_config.h"
|
#include "ompi_config.h"
|
||||||
#include "include/types.h"
|
#include "include/types.h"
|
||||||
@ -34,6 +35,7 @@ OBJ_CLASS_DECLARATION(mca_ns_replica_name_tracker_t);
|
|||||||
extern mca_ns_base_cellid_t mca_ns_replica_last_used_cellid;
|
extern mca_ns_base_cellid_t mca_ns_replica_last_used_cellid;
|
||||||
extern mca_ns_base_jobid_t mca_ns_replica_last_used_jobid;
|
extern mca_ns_base_jobid_t mca_ns_replica_last_used_jobid;
|
||||||
extern ompi_list_t mca_ns_replica_name_tracker;
|
extern ompi_list_t mca_ns_replica_name_tracker;
|
||||||
|
extern pthread_t *mca_ns_replica_thread;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Module open / close
|
* Module open / close
|
||||||
@ -51,11 +53,10 @@ int mca_ns_replica_finalize(void);
|
|||||||
/*
|
/*
|
||||||
* oob interface
|
* oob interface
|
||||||
*/
|
*/
|
||||||
|
/*
|
||||||
|
void *mca_ns_replica_recv_thread(void*);
|
||||||
|
|
||||||
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().
|
* Implementation of create_cellid().
|
||||||
*/
|
*/
|
||||||
|
@ -54,6 +54,7 @@ static mca_ns_base_module_t mca_ns_replica = {
|
|||||||
ns_replica_create_cellid,
|
ns_replica_create_cellid,
|
||||||
ns_replica_create_jobid,
|
ns_replica_create_jobid,
|
||||||
ns_base_create_process_name,
|
ns_base_create_process_name,
|
||||||
|
ns_base_convert_string_to_process_name,
|
||||||
ns_replica_reserve_range,
|
ns_replica_reserve_range,
|
||||||
ns_replica_free_name,
|
ns_replica_free_name,
|
||||||
ns_base_get_proc_name_string,
|
ns_base_get_proc_name_string,
|
||||||
@ -167,7 +168,7 @@ int mca_ns_replica_finalize(void)
|
|||||||
|
|
||||||
return OMPI_SUCCESS;
|
return OMPI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
mca_oob_callback_fn_t mca_ns_replica_recv(int status, const ompi_process_name_t *sender,
|
mca_oob_callback_fn_t mca_ns_replica_recv(int status, const ompi_process_name_t *sender,
|
||||||
const struct iovec *msg, size_t count,
|
const struct iovec *msg, size_t count,
|
||||||
void *cbdata)
|
void *cbdata)
|
||||||
@ -177,9 +178,9 @@ mca_oob_callback_fn_t mca_ns_replica_recv(int status, const ompi_process_name_t
|
|||||||
struct iovec reply;
|
struct iovec reply;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i=0; i<count; i++) { /* loop through all included commands */
|
for (i=0; i<count; i++) { loop through all included commands
|
||||||
cmd = (ompi_ns_msg_buffer_t*)msg->iov_base;
|
cmd = (ompi_ns_msg_buffer_t*)msg->iov_base;
|
||||||
if (OMPI_NS_CREATE_CELLID == cmd->command) { /* got create_cellid command */
|
if (OMPI_NS_CREATE_CELLID == cmd->command) { got create_cellid command
|
||||||
tmp1 = ompi_name_server.create_cellid();
|
tmp1 = ompi_name_server.create_cellid();
|
||||||
answer.command = cmd->command;
|
answer.command = cmd->command;
|
||||||
answer.buflen = sizeof(tmp1);
|
answer.buflen = sizeof(tmp1);
|
||||||
@ -192,3 +193,4 @@ mca_oob_callback_fn_t mca_ns_replica_recv(int status, const ompi_process_name_t
|
|||||||
}
|
}
|
||||||
return OMPI_SUCCESS;
|
return OMPI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
@ -71,11 +71,7 @@ int MPI_Comm_connect(char *port_name, MPI_Info info, int root,
|
|||||||
* translate the port_name string into the according process_name_t
|
* translate the port_name string into the according process_name_t
|
||||||
* structure. This functionality is currently missing from ns.
|
* structure. This functionality is currently missing from ns.
|
||||||
*/
|
*/
|
||||||
#if 0
|
|
||||||
port_proc_name = ompi_name_server.convert_string_to_process_name(port_name);
|
port_proc_name = ompi_name_server.convert_string_to_process_name(port_name);
|
||||||
#else
|
|
||||||
port_proc_name = NULL;
|
|
||||||
#endif
|
|
||||||
if ( NULL == port_proc_name ) {
|
if ( NULL == port_proc_name ) {
|
||||||
*newcomm = MPI_COMM_NULL;
|
*newcomm = MPI_COMM_NULL;
|
||||||
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_PORT, FUNC_NAME);
|
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_PORT, FUNC_NAME);
|
||||||
|
@ -74,11 +74,7 @@ int MPI_Comm_join(int fd, MPI_Comm *intercomm)
|
|||||||
ompi_socket_send (fd, name, len);
|
ompi_socket_send (fd, name, len);
|
||||||
ompi_socket_recv (fd, rname, rlen);
|
ompi_socket_recv (fd, rname, rlen);
|
||||||
|
|
||||||
#if 0
|
|
||||||
port_pname = ompi_name_server.convert_string_to_process_name(rname);
|
port_pname = ompi_name_server.convert_string_to_process_name(rname);
|
||||||
#else
|
|
||||||
port_pname = NULL;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
mask = OMPI_NS_CMP_CELLID | OMPI_NS_CMP_JOBID | OMPI_NS_CMP_VPID;
|
mask = OMPI_NS_CMP_CELLID | OMPI_NS_CMP_JOBID | OMPI_NS_CMP_VPID;
|
||||||
rc = ompi_name_server.compare (mask, &myproc[0]->proc_name, port_proc_name );
|
rc = ompi_name_server.compare (mask, &myproc[0]->proc_name, port_proc_name );
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user