Got to do some file moving - sorry about the multiple messages.
This commit was SVN r1613.
Этот коммит содержится в:
родитель
1ebac92718
Коммит
96abd45aab
src/mca/ns
@ -2,31 +2,31 @@
|
|||||||
# $HEADER$
|
# $HEADER$
|
||||||
#
|
#
|
||||||
|
|
||||||
include $(top_srcdir)/config/Makefile.options
|
# Use the top-level Makefile.options
|
||||||
|
|
||||||
noinst_LTLIBRARIES = libmca_ns_base.la
|
include $(top_ompi_srcdir)/config/Makefile.options
|
||||||
|
|
||||||
# For VPATH builds, have to specify where static-modules.h will be found
|
SUBDIRS = src
|
||||||
|
|
||||||
AM_CPPFLAGS = -I$(top_builddir)/src
|
# Make the output library in this directory, and name it either
|
||||||
|
# mca_<type>_<name>.la (for DSO builds) or libmca_<type>_<name>.la
|
||||||
|
# (for static builds).
|
||||||
|
|
||||||
# Source code files
|
if OMPI_BUILD_ns_base_DSO
|
||||||
|
component_noinst =
|
||||||
headers = \
|
component_install = mca_ns_base.la
|
||||||
base.h
|
|
||||||
|
|
||||||
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
|
else
|
||||||
ompidir = $(includedir)
|
component_noinst = libmca_ns_base.la
|
||||||
|
component_install =
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
mcacomponentdir = $(libdir)/openmpi
|
||||||
|
mcacomponent_LTLIBRARIES = $(component_install)
|
||||||
|
mca_ns_base_la_SOURCES =
|
||||||
|
mca_ns_base_la_LIBADD = src/libmca_ns_base.la
|
||||||
|
mca_ns_base_la_LDFLAGS = -module -avoid-version
|
||||||
|
|
||||||
|
noinst_LTLIBRARIES = $(component_noinst)
|
||||||
|
libmca_ns_base_la_SOURCES =
|
||||||
|
libmca_ns_base_la_LIBADD = src/libmca_ns_base.la
|
||||||
|
libmca_ns_base_la_LDFLAGS = -module -avoid-version
|
||||||
|
@ -1,127 +0,0 @@
|
|||||||
/*
|
|
||||||
* $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.
|
|
||||||
*
|
|
||||||
* Decide whether or not to be a replica, then call appropriate
|
|
||||||
* component to init module.
|
|
||||||
*/
|
|
||||||
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;
|
|
||||||
}
|
|
39
src/mca/ns/base/src/ns_base_select.c
Обычный файл
39
src/mca/ns/base/src/ns_base_select.c
Обычный файл
@ -0,0 +1,39 @@
|
|||||||
|
/*
|
||||||
|
* $HEADER$
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "ompi_config.h"
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include "runtime/runtime.h"
|
||||||
|
#include "util/output.h"
|
||||||
|
#include "util/proc_info.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.
|
||||||
|
*
|
||||||
|
* Decide whether or not to be a replica, then call appropriate
|
||||||
|
* component to init module.
|
||||||
|
*/
|
||||||
|
int mca_ns_base_select(bool *allow_multi_user_threads,
|
||||||
|
bool *have_hidden_threads)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* check to see if I'm supposed to be a replica
|
||||||
|
* definitely 'yes' if I'm the seed daemon
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (ompi_process_info.seed) { /* true if I'm the seed daemon */
|
||||||
|
ompi_name_server = *mca_ns_replica_init(bool *allow_multi_user_threads,
|
||||||
|
bool *have_hidden_threads);
|
||||||
|
}
|
||||||
|
|
||||||
|
return OMPI_SUCCESS;
|
||||||
|
}
|
@ -62,22 +62,6 @@ ompi_process_id_t ns_replica_create_jobid(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ompi_process_name_t* ns_replica_create_process_name(ompi_process_id_t cell,
|
|
||||||
ompi_process_id_t job, ompi_process_id_t vpid)
|
|
||||||
{
|
|
||||||
ompi_process_name_t *newname;
|
|
||||||
|
|
||||||
newname = OBJ_NEW(ompi_process_name_t);
|
|
||||||
if (NULL == newname) { /* got an error */
|
|
||||||
return(NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
newname->cellid = cell;
|
|
||||||
newname->jobid = job;
|
|
||||||
newname->vpid = vpid;
|
|
||||||
return(newname);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
ompi_process_id_t ns_replica_reserve_range(ompi_process_id_t job, ompi_process_id_t range)
|
ompi_process_id_t ns_replica_reserve_range(ompi_process_id_t job, ompi_process_id_t range)
|
||||||
{
|
{
|
||||||
@ -103,163 +87,3 @@ int ns_replica_free_name(ompi_process_name_t* name)
|
|||||||
{
|
{
|
||||||
return OMPI_SUCCESS;
|
return OMPI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
char* ns_replica_get_proc_name_string(const ompi_process_name_t* name)
|
|
||||||
{
|
|
||||||
char *name_string;
|
|
||||||
int size;
|
|
||||||
|
|
||||||
if (NULL == name) { /* got an error */
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
char* ns_replica_get_vpid_string(const ompi_process_name_t* name)
|
|
||||||
{
|
|
||||||
char *name_string;
|
|
||||||
int size;
|
|
||||||
|
|
||||||
if (NULL == name) { /* got an error */
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
char* ns_replica_get_jobid_string(const ompi_process_name_t* name)
|
|
||||||
{
|
|
||||||
char *name_string;
|
|
||||||
int size;
|
|
||||||
|
|
||||||
if (NULL == name) { /* got an error */
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
char* ns_replica_get_cellid_string(const ompi_process_name_t* name)
|
|
||||||
{
|
|
||||||
char *name_string;
|
|
||||||
int size;
|
|
||||||
|
|
||||||
if (NULL == name) { /* got an error */
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
ompi_process_id_t ns_replica_get_vpid(const ompi_process_name_t* name)
|
|
||||||
{
|
|
||||||
if (NULL == name) { /* got an error */
|
|
||||||
return(OMPI_NAME_SERVICE_MAX);
|
|
||||||
}
|
|
||||||
|
|
||||||
return(name->vpid);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
ompi_process_id_t ns_replica_get_jobid(const ompi_process_name_t* name)
|
|
||||||
{
|
|
||||||
if (NULL == name) { /* got an error */
|
|
||||||
return(OMPI_NAME_SERVICE_MAX);
|
|
||||||
}
|
|
||||||
|
|
||||||
return(name->jobid);
|
|
||||||
}
|
|
||||||
|
|
||||||
ompi_process_id_t ns_replica_get_cellid(const ompi_process_name_t* name)
|
|
||||||
{
|
|
||||||
if (NULL == name) { /* got an error */
|
|
||||||
return(OMPI_NAME_SERVICE_MAX);
|
|
||||||
}
|
|
||||||
|
|
||||||
return(name->cellid);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int ns_replica_compare(ompi_ns_cmp_bitmask_t fields,
|
|
||||||
const ompi_process_name_t* name1,
|
|
||||||
const ompi_process_name_t* name2)
|
|
||||||
{
|
|
||||||
if ((fields <= 0) || (fields > 7) || NULL == name1 || NULL == name2) { /* got an error */
|
|
||||||
return(-100);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (OMPI_NS_CMP_CELLID & fields) { /* check cellid field */
|
|
||||||
if (name1->cellid < name2->cellid) {
|
|
||||||
return(-1);
|
|
||||||
} else if (name1->cellid > name2->cellid) {
|
|
||||||
return(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* get here if cellid's are equal, or cellid not being checked */
|
|
||||||
/* now check job id */
|
|
||||||
|
|
||||||
if (OMPI_NS_CMP_JOBID & fields) {
|
|
||||||
if (name1->jobid < name2->jobid) {
|
|
||||||
return(-1);
|
|
||||||
} else if (name1->jobid > name2->jobid) {
|
|
||||||
return(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* get here if cellid's and jobid's are equal, or neither being checked,
|
|
||||||
* or cellid not checked and jobid's equal.
|
|
||||||
* now check vpid
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (OMPI_NS_CMP_VPID & fields) {
|
|
||||||
if (name1->vpid < name2->vpid) {
|
|
||||||
return(-1);
|
|
||||||
} else if (name1->vpid > name2->vpid) {
|
|
||||||
return(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* only way to get here is if all fields are being checked and are equal,
|
|
||||||
* or cellid not checked, but jobid and vpid equal,
|
|
||||||
* or cellid and jobid not checked, but vpid equal,
|
|
||||||
* only vpid being checked, and equal
|
|
||||||
* return that fact
|
|
||||||
*/
|
|
||||||
return(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
@ -49,17 +49,17 @@ mca_ns_base_module_t mca_ns_replica_module = {
|
|||||||
mca_ns_t mca_ns_replica = {
|
mca_ns_t mca_ns_replica = {
|
||||||
ns_replica_create_cellid,
|
ns_replica_create_cellid,
|
||||||
ns_replica_create_jobid,
|
ns_replica_create_jobid,
|
||||||
ns_replica_create_process_name,
|
ns_base_create_process_name,
|
||||||
ns_replica_reserve_range,
|
ns_replica_reserve_range,
|
||||||
ns_replica_free_name,
|
ns_replica_free_name,
|
||||||
ns_replica_get_proc_name_string,
|
ns_base_get_proc_name_string,
|
||||||
ns_replica_get_vpid_string,
|
ns_base_get_vpid_string,
|
||||||
ns_replica_get_jobid_string,
|
ns_base_get_jobid_string,
|
||||||
ns_replica_get_cellid_string,
|
ns_base_get_cellid_string,
|
||||||
ns_replica_get_vpid,
|
ns_base_get_vpid,
|
||||||
ns_replica_get_jobid,
|
ns_base_get_jobid,
|
||||||
ns_replica_get_cellid,
|
ns_base_get_cellid,
|
||||||
ns_replica_compare
|
ns_base_compare
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -96,12 +96,6 @@ ompi_list_t ompi_name_tracker;
|
|||||||
int
|
int
|
||||||
mca_ns_replica_open(void)
|
mca_ns_replica_open(void)
|
||||||
{
|
{
|
||||||
last_used_cellid = 0;
|
|
||||||
last_used_jobid = 0;
|
|
||||||
|
|
||||||
/* initialize the name tracker */
|
|
||||||
OBJ_CONSTRUCT(&ompi_name_tracker, ompi_list_t);
|
|
||||||
|
|
||||||
return OMPI_SUCCESS;
|
return OMPI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -116,12 +110,13 @@ mca_ns_replica_close(void)
|
|||||||
|
|
||||||
mca_ns_t* mca_ns_replica_init(bool *allow_multi_user_threads, bool *have_hidden_threads)
|
mca_ns_t* mca_ns_replica_init(bool *allow_multi_user_threads, bool *have_hidden_threads)
|
||||||
{
|
{
|
||||||
return NULL;
|
last_used_cellid = 0;
|
||||||
/* should I be a replica or not? */
|
last_used_jobid = 0;
|
||||||
|
|
||||||
/* if no, return NULL */
|
/* initialize the name tracker */
|
||||||
|
OBJ_CONSTRUCT(&ompi_name_tracker, ompi_list_t);
|
||||||
|
|
||||||
/* if yes, setup storage for tracking names and return &mca_ns_replica */
|
return &mca_ns_replica;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user