1
1

* back out r1965 until we can figure out why it causes failures. Also edit

comm_join and comm_connect to #if 0 out the calls to the ns added in 
  r1965

This commit was SVN r1994.

The following SVN revision numbers were found above:
  r1965 --> open-mpi/ompi@48c8d55b6d
Этот коммит содержится в:
Brian Barrett 2004-08-10 02:36:49 +00:00
родитель 593b0542ae
Коммит 882c458534
8 изменённых файлов: 75 добавлений и 154 удалений

Просмотреть файл

@ -35,8 +35,6 @@ extern "C" {
mca_ns_base_jobid_t job,
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_vpid_string(const ompi_process_name_t* name);

Просмотреть файл

@ -28,12 +28,6 @@ ompi_process_name_t* ns_base_create_process_name(mca_ns_base_cellid_t cell,
{
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);
if (NULL == newname) { /* got an error */
return(NULL);
@ -49,97 +43,39 @@ 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 *name_string;
int size;
if (NULL == name) { /* got an error */
return(NULL);
}
if (0 > asprintf(&name_string, "%0X.%0X.%0X", name->cellid, name->jobid, name->vpid)) {
return NULL;
size = (3*sizeof(name->cellid)/4) + 3;
name_string = (char*)malloc(27*sizeof(char));
if (NULL == name_string) { /* got an error */
return(NULL);
}
sprintf(name_string, "%0x.%0x.%0x", name->cellid, name->jobid, name->vpid);
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 *name_string;
int size;
if (NULL == name) { /* got an error */
return(NULL);
}
if (0 > asprintf(&name_string, "%0X", name->vpid)) {
return NULL;
size = 1 + sizeof(name->vpid)/4;
name_string = (char*)malloc(size*sizeof(char));
if (NULL == name_string) { /* got an error */
return(NULL);
}
sprintf(name_string, "%0x", name->vpid);
return(name_string);
}
@ -147,15 +83,19 @@ 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 *name_string;
int size;
if (NULL == name) { /* got an error */
return(NULL);
}
if (0 > asprintf(&name_string, "%0X", name->jobid)) {
return NULL;
size = 1 + sizeof(name->jobid);
name_string = (char*)malloc(size*sizeof(char));
if (NULL == name_string) { /* got an error */
return(NULL);
}
sprintf(name_string, "%0x", name->jobid);
return(name_string);
}
@ -163,15 +103,19 @@ 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 *name_string;
int size;
if (NULL == name) { /* got an error */
return(NULL);
}
if (0 > asprintf(&name_string, "%0X", name->cellid)) {
return NULL;
size = 1 + sizeof(name->cellid);
name_string = (char*)malloc(size*sizeof(char));
if (NULL == name_string) { /* got an error */
return(NULL);
}
sprintf(name_string, "%0x", name->cellid);
return(name_string);
}
@ -179,7 +123,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)
{
if (NULL == name) { /* got an error */
return(MCA_NS_BASE_VPID_MAX);
return(OMPI_NAME_SERVICE_MAX);
}
return(name->vpid);
@ -189,7 +133,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)
{
if (NULL == name) { /* got an error */
return(MCA_NS_BASE_JOBID_MAX);
return(OMPI_NAME_SERVICE_MAX);
}
return(name->jobid);
@ -198,7 +142,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)
{
if (NULL == name) { /* got an error */
return(MCA_NS_BASE_CELLID_MAX);
return(OMPI_NAME_SERVICE_MAX);
}
return(name->cellid);

Просмотреть файл

@ -39,9 +39,7 @@
/*
* define maximum value for id's in any field
*/
#define MCA_NS_BASE_CELLID_MAX UINT32_MAX
#define MCA_NS_BASE_JOBID_MAX UINT32_MAX
#define MCA_NS_BASE_VPID_MAX UINT32_MAX
#define OMPI_NAME_SERVICE_MAX UINT32_MAX
/*
* general typedefs & structures
@ -92,16 +90,14 @@ typedef struct ompi_ns_msg_buffer_t ompi_ns_msg_buffer_t;
* Create a new cell id.
* 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
* 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).
* number. No memory for names is allocated by this process.
*
* @param None
* @retval cellid The numerical value of the allocated cell id. A value of
* MCA_NS_BASE_CELLID_MAX indicates
* that an error occurred - this represents a very unlikely
* @retval cellid The ompi_process_id_t value of the allocated cell id. There currently
* is no error indication that a cell id could not be allocated - this represents a very unlikely
* 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.
* Some means of returning a value indicative of an error will be devised in the future.
*
* @code
* new_cellid = ompi_name_server.create_cellid()
@ -113,21 +109,18 @@ typedef mca_ns_base_cellid_t (*mca_ns_base_module_create_cellid_fn_t)(void);
* Create a new job id.
* 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
* 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).
* number. No memory for names is allocated by this process.
*
* 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
* and proceed to request names against it.
*
* @param None
* @retval jobid The numerical value of the allocated job id. A value of
* MCA_NS_BASE_JOBID_MAX indicates
* that an error occurred - this represents a very unlikely
* @retval jobid The ompi_process_id_t value of the allocated job id. There currently
* is no error indication that a job id could not be allocated - this represents a very unlikely
* 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.
* Some means of returning a value indicative of an error will be devised in the future.
*
* @code
* new_jobid = ompi_name_server.create_jobid()
@ -162,25 +155,6 @@ 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);
/**
* 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.
* The reserve_range() function reserves a range of vpid's for the given jobid.
@ -192,8 +166,9 @@ typedef ompi_process_name_t* (*mca_ns_base_module_convert_string_to_process_name
* 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.
*
* @retval startid The starting value of the reserved range of vpid's. A value of MCA_NS_BASE_VPID_MAX
* indicates that an error occurred.
* @retval startid The starting value of the reserved range of vpid's. At this time,
* no means for returning an error condition is available. This will be rectified in the
* near future.
*
* @code
* starting_procid = ompi_name_server.reserve_range(jobid, range)
@ -315,15 +290,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);
/**
* Get the virtual process id as a numeric value.
* The get_vpid() function returns the vpid in a numeric representation -
* Get the virtual process id as an ompi_process_id_t value.
* The get_vpid() function returns the vpid in an ompi_process_id_t representation -
* i.e., in an integer form.
*
* @param *name A pointer to the name structure containing the name.
*
* @retval vpid The vpid field of the provided name.
* @retval MCA_NS_BASE_VPID_MAX Indicates that an error occurred - in this case, that
* the name variable provided was NULL.
* @retval vpid The vpid field of the provided name. There currently
* is no error indication that this function failed.
* Some means of returning a value indicative of an error will be devised in the future.
*
* @code
* vpid = ompi_name_server.get_vpid(&name)
@ -332,15 +307,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);
/**
* Get the job id as a numeric value.
* The get_jobid() function returns the job id in a numeric representation -
* Get the job id as an ompi_process_id_t value.
* The get_jobid() function returns the job id in an ompi_process_id_t representation -
* i.e., in an integer form.
*
* @param *name A pointer to the name structure containing the name.
*
* @retval jobid The job id field of the provided name.
* @retval MCA_NS_BASE_JOBID_MAX Indicates that an error occurred - in this case, that
* the name variable provided was NULL.
* @retval jobid The job id field of the provided name. There currently
* is no error indication that this function failed.
* Some means of returning a value indicative of an error will be devised in the future.
*
* @code
* jobid = ompi_name_server.get_jobid(&name)
@ -349,15 +324,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);
/**
* Get the cell id as a numberic value.
* The get_cellid() function returns the cell id in a numeric representation -
* Get the cell id as an ompi_process_id_t value.
* The get_cellid() function returns the cell id in an ompi_process_id_t representation -
* i.e., in an integer form.
*
* @param *name A pointer to the name structure containing the name.
*
* @retval cellid The cell id field of the provided name.
* @retval MCA_NS_BASE_CELLID_MAX Indicates that an error occurred - in this case, that
* the name variable provided was NULL.
* @retval cellid The cell id field of the provided name. There currently
* is no error indication that this function failed.
* Some means of returning a value indicative of an error will be devised in the future.
*
* @code
* cellid = ompi_name_server.get_cellid(&name)
@ -403,7 +378,6 @@ struct mca_ns_base_module_1_0_0_t {
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_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_free_name_fn_t free_name;
mca_ns_base_module_get_proc_name_string_fn_t get_proc_name_string;

Просмотреть файл

@ -22,11 +22,11 @@
mca_ns_base_cellid_t ns_replica_create_cellid(void)
{
if ((MCA_NS_BASE_CELLID_MAX-2) >= mca_ns_replica_last_used_cellid) {
if ((OMPI_NAME_SERVICE_MAX-1) >= mca_ns_replica_last_used_cellid) {
mca_ns_replica_last_used_cellid = mca_ns_replica_last_used_cellid + 1;
return(mca_ns_replica_last_used_cellid);
} else {
return MCA_NS_BASE_CELLID_MAX;
return(0);
}
}
@ -34,7 +34,7 @@ mca_ns_base_jobid_t ns_replica_create_jobid(void)
{
mca_ns_replica_name_tracker_t *new;
if ((MCA_NS_BASE_JOBID_MAX-2) >= mca_ns_replica_last_used_jobid) {
if ((OMPI_NAME_SERVICE_MAX-1) >= mca_ns_replica_last_used_jobid) {
mca_ns_replica_last_used_jobid = mca_ns_replica_last_used_jobid + 1;
new = OBJ_NEW(mca_ns_replica_name_tracker_t);
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);
return(mca_ns_replica_last_used_jobid);
} else {
return MCA_NS_BASE_JOBID_MAX;
return(0);
}
}
@ -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_next(ptr)) {
if (job == ptr->job) { /* found the specified job */
if ((MCA_NS_BASE_VPID_MAX-range-2) >= ptr->last_used_vpid) { /* requested range available */
if ((OMPI_NAME_SERVICE_MAX-range-1) >= ptr->last_used_vpid) { /* requested range available */
start = ptr->last_used_vpid + 1;
ptr->last_used_vpid = ptr->last_used_vpid + range;
return(start);
}
}
}
return MCA_NS_BASE_VPID_MAX;
return(0);
}

Просмотреть файл

@ -6,7 +6,6 @@
#ifndef NS_REPLICA_H
#define NS_REPLICA_H
#include <pthread.h>
#include "ompi_config.h"
#include "include/types.h"
@ -35,7 +34,6 @@ 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_jobid_t mca_ns_replica_last_used_jobid;
extern ompi_list_t mca_ns_replica_name_tracker;
extern pthread_t *mca_ns_replica_thread;
/*
* Module open / close
@ -53,10 +51,11 @@ int mca_ns_replica_finalize(void);
/*
* 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().
*/

Просмотреть файл

@ -54,7 +54,6 @@ static mca_ns_base_module_t mca_ns_replica = {
ns_replica_create_cellid,
ns_replica_create_jobid,
ns_base_create_process_name,
ns_base_convert_string_to_process_name,
ns_replica_reserve_range,
ns_replica_free_name,
ns_base_get_proc_name_string,
@ -168,7 +167,7 @@ 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)
@ -178,9 +177,9 @@ mca_oob_callback_fn_t mca_ns_replica_recv(int status, const ompi_process_name_t
struct iovec reply;
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;
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();
answer.command = cmd->command;
answer.buflen = sizeof(tmp1);
@ -193,4 +192,3 @@ mca_oob_callback_fn_t mca_ns_replica_recv(int status, const ompi_process_name_t
}
return OMPI_SUCCESS;
}
*/

Просмотреть файл

@ -71,7 +71,11 @@ int MPI_Comm_connect(char *port_name, MPI_Info info, int root,
* translate the port_name string into the according process_name_t
* structure. This functionality is currently missing from ns.
*/
#if 0
port_proc_name = ompi_name_server.convert_string_to_process_name(port_name);
#else
port_proc_name = NULL;
#endif
if ( NULL == port_proc_name ) {
*newcomm = MPI_COMM_NULL;
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_PORT, FUNC_NAME);

Просмотреть файл

@ -74,7 +74,11 @@ int MPI_Comm_join(int fd, MPI_Comm *intercomm)
ompi_socket_send (fd, name, len);
ompi_socket_recv (fd, rname, rlen);
#if 0
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;
rc = ompi_name_server.compare (mask, &myproc[0]->proc_name, port_proc_name );