1
1

Add the base functions - and yes, they do compile :-)

Put a permanent fix into the include files to avoid the circular reference. You only need to include the "base.h" file now and it will pickup the ns.h file for you. Anyone working on components for the name server, however, should be warned that including the ns.h directly by itself (instead of going through base.h) will yield several unresolved errors.

Ignore the replica component - it is bogus at this time.

This commit was SVN r1537.
Этот коммит содержится в:
Ralph Castain 2004-07-02 01:24:53 +00:00
родитель 0d38fe6a5f
Коммит 0f86a5f772
8 изменённых файлов: 263 добавлений и 27 удалений

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

@ -10,11 +10,12 @@ noinst_LTLIBRARIES = libns.la
# Source code files
headers = \
name_server.h
base\base.h \
ns.h
libns_la_SOURCES = \
$(headers) \
name_server.c
replica/name_server.c
# Conditionally install the header files

33
src/mca/ns/base/Makefile.am Обычный файл
Просмотреть файл

@ -0,0 +1,33 @@
#
# $HEADER$
#
include $(top_srcdir)/config/Makefile.options
noinst_LTLIBRARIES = libmca_ns_base.la
# For VPATH builds, have to specify where static-modules.h will be found
AM_CPPFLAGS = -I$(top_builddir)/src
# Source code files
headers = \
base.h
# Library
libmca_ns_base_la_SOURCES = \
$(headers) \
ns_base_close.c \
ns_base_open.c \
ns_base_select.c
# Conditionally install the header files
if WANT_INSTALL_HEADERS
ompidir = $(includedir)/openmpi/mca/ns/base
ompi_HEADERS = $(headers)
else
ompidir = $(includedir)
endif

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

@ -16,20 +16,6 @@
#include "mca/ns/ns.h"
/*
* typedefs
*/
typedef uint32_t ompi_process_id_t; /**< Set the allowed range for id's in each space */
struct ompi_process_name_t {
ompi_process_id_t cellid; /**< Cell number */
ompi_process_id_t jobid; /**< Job number */
ompi_process_id_t procid; /**< Process number */
};
typedef struct ompi_process_name_t ompi_process_name_t;
/*
* Global functions for MCA overall collective open and close
*/
@ -49,9 +35,10 @@ extern "C" {
* globals that might be needed
*/
extern struct mca_ns_1_0_0_t ompi_name_server; /* holds selected module's function pointers */
extern int mca_ns_base_output;
extern mca_ns_t ompi_name_server; /* holds selected module's function pointers */
extern ompi_list_t mca_ns_base_modules_available;
extern struct mca_ns_base_module_1_0_0_t mca_ns_base_selected_module;
extern mca_ns_base_module_t mca_ns_base_selected_module;
/*
* external API functions will be documented in the mca/ns/ns.h file

26
src/mca/ns/base/ns_base_close.c Обычный файл
Просмотреть файл

@ -0,0 +1,26 @@
/*
* $HEADER$
*/
#include "ompi_config.h"
#include <stdio.h>
#include "include/constants.h"
#include "mca/mca.h"
#include "mca/base/base.h"
#include "mca/ns/base/base.h"
int mca_ns_base_close(void)
{
/* Close all remaining available modules (may be one if this is a
OMPI RTE program, or [possibly] multiple if this is ompi_info) */
mca_base_modules_close(mca_ns_base_output,
&mca_ns_base_modules_available, NULL);
/* All done */
return OMPI_SUCCESS;
}

47
src/mca/ns/base/ns_base_open.c Обычный файл
Просмотреть файл

@ -0,0 +1,47 @@
/*
* $HEADER$
*/
#include "ompi_config.h"
#include "mca/mca.h"
#include "mca/base/base.h"
#include "mca/ns/base/base.h"
/*
* The following file was created by configure. It contains extern
* statements and the definition of an array of pointers to each
* module's public mca_base_module_t struct.
*/
#include "mca/ns/base/static-modules.h"
/*
* Global variables
*/
int mca_ns_base_output = -1;
mca_ns_t ompi_name_server;
ompi_list_t mca_ns_base_modules_available;
mca_ns_base_module_t mca_ns_base_selected_module;
/**
* Function for finding and opening either all MCA modules, or the one
* that was specifically requested via a MCA parameter.
*/
int mca_ns_base_open(void)
{
/* Open up all available modules */
if (OMPI_SUCCESS !=
mca_base_modules_open("ns", 0, mca_ns_base_static_modules,
&mca_ns_base_modules_available)) {
return OMPI_ERROR;
}
/* All done */
return OMPI_SUCCESS;
}

128
src/mca/ns/base/ns_base_select.c Обычный файл
Просмотреть файл

@ -0,0 +1,128 @@
/*
* $HEADER$
*/
#include "ompi_config.h"
#include <stdio.h>
#include "runtime/runtime.h"
#include "util/output.h"
#include "mca/mca.h"
#include "mca/base/base.h"
#include "mca/ns/base/base.h"
/**
* Function for selecting one module from all those that are
* available.
*
* Call the init function on all available modules and get their
* priorities. Select the module with the highest priority. All
* other modules will be closed and unloaded.
*/
int mca_ns_base_select(bool *allow_multi_user_threads,
bool *have_hidden_threads)
{
int priority, best_priority;
bool user_threads, hidden_threads;
bool best_user_threads, best_hidden_threads;
ompi_list_item_t *item;
mca_base_module_list_item_t *mli;
mca_ns_base_module_t *module, *best_module;
mca_ns_t *actions, *best_actions;
extern ompi_list_t mca_ns_base_modules_available;
/* Traverse the list of available modules; call their init
functions. */
/* best_priority = -1;
best_module = NULL;
for (item = ompi_list_get_first(&mca_pcm_base_modules_available);
ompi_list_get_end(&mca_pcm_base_modules_available) != item;
item = ompi_list_get_next(item)) {
mli = (mca_base_module_list_item_t *) item;
module = (mca_pcm_base_module_t *) mli->mli_module;
ompi_output_verbose(10, mca_pcm_base_output,
"select: initializing %s module %s",
module->pcmm_version.mca_type_name,
module->pcmm_version.mca_module_name);
if (NULL == module->pcmm_init) {
ompi_output_verbose(10, mca_pcm_base_output,
"select: no init function; ignoring module");
} else {
actions = module->pcmm_init(&priority, &user_threads, &hidden_threads);
if (NULL == actions) {
ompi_output_verbose(10, mca_pcm_base_output,
"select: init returned failure");
} else {
ompi_output_verbose(10, mca_pcm_base_output,
"select: init returned priority %d", priority);
if (priority > best_priority) {
best_priority = priority;
best_user_threads = user_threads;
best_hidden_threads = hidden_threads;
best_module = module;
best_actions = actions;
}
}
}
}
*/
/* Finished querying all modules. Check for the bozo case. */
return (OMPI_SUCCESS);
if (NULL == best_module) {
/* JMS Replace with show_help */
ompi_abort(1, "No PCM module available. This shouldn't happen.");
}
/* Finalize all non-selected modules */
/*
for (item = ompi_list_get_first(&mca_pcm_base_modules_available);
ompi_list_get_end(&mca_pcm_base_modules_available) != item;
item = ompi_list_get_next(item)) {
mli = (mca_base_module_list_item_t *) item;
module = (mca_pcm_base_module_t *) mli->mli_module;
if (module != best_module) {
*/
/* Finalize */
/* if (NULL != module->pcmm_finalize) {
*/
/* Blatently ignore the return code (what would we do to
recover, anyway? This module is going away, so errors
don't matter anymore) */
/*
module->pcmm_finalize();
ompi_output_verbose(10, mca_pcm_base_output,
"select: module %s finalized",
module->pcmm_version.mca_module_name);
}
}
}
*/
/* This base function closes, unloads, and removes from the
available list all unselected modules. The available list will
contain only the selected module. */
/*
mca_base_modules_close(mca_pcm_base_output, &mca_pcm_base_modules_available,
(mca_base_module_t *) best_module);
*/
/* Save the winner */
/*
mca_pcm_base_selected_module = *best_module;
mca_pcm = *best_actions;
*allow_multi_user_threads = best_user_threads;
*have_hidden_threads = best_hidden_threads;
ompi_output_verbose(10, mca_pcm_base_output,
"select: module %s initialized",
module->pcmm_version.mca_module_name);
*/
/* All done */
return OMPI_SUCCESS;
}

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

@ -26,7 +26,20 @@
#include "class/ompi_list.h"
#include "mca/mca.h"
#include "mca/ns/base/base.h"
/*
* general typedefs & structures
*/
typedef uint32_t ompi_process_id_t; /**< Set the allowed range for id's in each space */
struct ompi_process_name_t {
ompi_process_id_t cellid; /**< Cell number */
ompi_process_id_t jobid; /**< Job number */
ompi_process_id_t procid; /**< Process number */
};
typedef struct ompi_process_name_t ompi_process_name_t;
/*

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

@ -17,7 +17,8 @@
#include "ompi_config.h"
#include "include/constants.h"
#include "ns/name_server.h"
#include "mca/ns/base/base.h"
#include "mca/ns/ns.h"
/*
* defines
@ -27,10 +28,10 @@
/**
* globals
*/
ompi_process_name_t ompi_name_service = 0;
ompi_process_name_t OMPI_NAME_SERVICE_MAX = 0xffffffffffffffff;
ompi_process_id_t ompi_name_service = 0;
ompi_process_id_t OMPI_NAME_SERVICE_MAX = 0xffffffffffffffff;
ompi_process_name_t ompi_process_name_new(void)
ompi_process_id_t ompi_process_name_new(void)
{
if (OMPI_NAME_SERVICE_MAX > ompi_name_service) {
ompi_name_service = ompi_name_service + 1;
@ -40,7 +41,7 @@ ompi_process_name_t ompi_process_name_new(void)
}
}
ompi_process_name_t ompi_process_name_get_range (ompi_process_name_t range)
ompi_process_id_t ompi_process_name_get_range (ompi_process_id_t range)
{
if ((OMPI_NAME_SERVICE_MAX-range) > ompi_name_service) {
ompi_name_service = ompi_name_service + range;
@ -50,17 +51,17 @@ ompi_process_name_t ompi_process_name_get_range (ompi_process_name_t range)
}
}
int ompi_process_name_free(ompi_process_name_t name)
int ompi_process_name_free(ompi_process_id_t name)
{
return OMPI_SUCCESS;
}
int ompi_process_name_free_range(ompi_process_name_t name, ompi_process_name_t range)
int ompi_process_name_free_range(ompi_process_id_t name, ompi_process_id_t range)
{
return OMPI_SUCCESS;
}
char *ompi_convert_process_name_to_string(ompi_process_name_t name)
char *ompi_convert_process_name_to_string(ompi_process_id_t name)
{
char * name_string;
uint32_t *name32;