1
1

Add the name server to the system. Code checked by Jeff - thanks!

The name server provides a 64-bit name - no structure to it. If I put a structure in (as Graham had proposed), then I had to track the allocations in each piece of the structure. Quite doable - but this was much simpler and adequate for now. Hard to believe we would hit 64-bits worth of names...but we can change it later, if needed.

This commit was SVN r1302.
Этот коммит содержится в:
Ralph Castain 2004-06-16 03:40:05 +00:00
родитель a0cfd47135
Коммит e648b8573f
2 изменённых файлов: 136 добавлений и 0 удалений

61
src/ns/name_server.c Обычный файл
Просмотреть файл

@ -0,0 +1,61 @@
/*
* $HEADER$
*/
/** @file:
*
* The Open MPI Name Server
*
* The Open MPI Name Server provides unique name ranges for processes within the
* universe. Each universe will have one name server running within the seed daemon.
* This is done to prevent the inadvertent duplication of names.
*
*/
/*
* includes
*/
#include "ompi_config.h"
#include "include/constants.h"
#include "ns/name_server.h"
/*
* defines
*/
#define OMPI_SUCCESS 1
/**
* globals
*/
ompi_process_name_t ompi_name_service = 0;
ompi_process_name_t OMPI_NAME_SERVICE_MAX = 0xffffffffffffffff;
ompi_process_name_t ompi_process_name_new(void)
{
if (OMPI_NAME_SERVICE_MAX > ompi_name_service) {
ompi_name_service = ompi_name_service + 1;
return(ompi_name_service);
} else {
return(0);
}
}
ompi_process_name_t ompi_process_name_get_range (ompi_process_name_t range)
{
if ((OMPI_NAME_SERVICE_MAX-range) > ompi_name_service) {
ompi_name_service = ompi_name_service + range;
return(ompi_name_service);
} else {
return(0);
}
}
int ompi_process_name_free(ompi_process_name_t name)
{
return OMPI_SUCCESS;
}
int ompi_process_name_free_range(ompi_process_name_t name, ompi_process_name_t range)
{
return OMPI_SUCCESS;
}

75
src/ns/name_server.h Обычный файл
Просмотреть файл

@ -0,0 +1,75 @@
/*
* $HEADER$
*/
/** @file:
*
* The Open MPI Name Server
*
* The Open MPI Name Server provides unique name ranges for processes within the
* universe. Each universe will have one name server running within the seed daemon.
* This is done to prevent the inadvertent duplication of names.
*
*/
/*
* includes
*/
#include <sys/types.h>
#include <stdint.h>
#include "ompi_config.h"
/*
* typedefs
*/
typedef uint64_t ompi_process_name_t;
/**
* Obtain a single new process name.
* The ompi_process_name_new() function obtains a single new process name.
*
* @return name An ompi_process_name_t value of the name. A value of
* 0 indicates that the name server is out of names.
*/
ompi_process_name_t ompi_process_name_new(void);
/**
* Obtain a range of process names.
* The ompi_process_name_get_range() function requests reservation of a range of
* names.
*
* @return name An ompi_process_name_t value of the name. A value of
* 0 indicates that the name server is out of names.
*/
ompi_process_name_t ompi_process_name_get_range(ompi_process_name_t range);
/**
* Releases a process name.
* The ompi_process_name_free() function will release a name for re-use. At this
* time, this function does nothing!! It will simply return OMPI_SUCCESS. This is
* here solely to reserve the function for further definition.
*
* @param name An ompi_process_name_t value of the name to be released.
* @return OMPI_SUCCESS At this time, this is always returned.
*/
int ompi_process_name_free(ompi_process_name_t name);
/**
* Release a range of process names.
* The ompi_process_name_free_range() function releases a range of names for re-use.
* At this time, this function does nothing!! This is here solely to reserve the
* function for further definition.
*
* @param name An ompi_process_name_t value indicating
* start of the range being freed.
* @param range An ompi_process_name_t value indicating how many names are being released.
*
* @return OMPI_SUCCESS Always returned at this time.
*/
int ompi_process_name_free_range(ompi_process_name_t name, ompi_process_name_t range);