1
1

* change the pcm slection to allow for both multiple components to be loaded

at the same time and multiple modules of the same component to be loaded
  at the same time (but not launching procs in the same job).
  - add a "this" pointer to all the PCM functions
  - make base select() function return a list of selected pcms, based on
    given criteria bitmask
  - update all the pcms to match
* Add a insert before position function to the ompi_list code

This commit was SVN r2590.
Этот коммит содержится в:
Brian Barrett 2004-09-10 04:54:17 +00:00
родитель 106e07f759
Коммит c8b03b0897
22 изменённых файлов: 330 добавлений и 198 удалений

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

@ -475,6 +475,29 @@ static inline ompi_list_item_t *ompi_list_remove_last(ompi_list_t *list)
return (ompi_list_item_t *) item;
}
/**
* Add an item to the list before a given element
*
* @param list The list container
* @param pos List element to insert \c item before
* @param item The item to insert
*
* Inserts \c item before \c pos. This is an O(1) operation.
*/
static inline void ompi_list_insert_pos(ompi_list_t *list, ompi_list_item_t *pos,
ompi_list_item_t *item)
{
/* point item at the existing elements */
item->ompi_list_next = pos;
item->ompi_list_prev = pos->ompi_list_prev;
/* splice into the list */
pos->ompi_list_prev->ompi_list_next = item;
pos->ompi_list_prev = item;
/* reset list length counter */
list->ompi_list_length++;
}
#if defined(c_plusplus) || defined(__cplusplus)
extern "C" {

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

@ -19,13 +19,17 @@
#if defined(c_plusplus) || defined(__cplusplus)
extern "C" {
#endif
int mca_pcm_base_open(void);
int mca_pcm_base_select(bool *allow_multi_user_threads,
bool *have_hidden_threads);
int mca_pcm_base_close(void);
int mca_pcm_base_open(void);
/* modules is a pointer to an array of pointers to mca_pcm_base_module_t structs */
int mca_pcm_base_select(bool *allow_multi_user_threads,
bool *have_hidden_threads,
int constraint,
mca_pcm_base_module_t ***modules,
int *modules_len);
char* mca_pcm_base_no_unique_name(void);
int mca_pcm_base_close(void);
char* mca_pcm_base_no_unique_name(struct mca_pcm_base_module_1_0_0_t* me);
int mca_pcm_base_send_schedule(FILE *fd,
mca_ns_base_jobid_t jobid,
@ -54,7 +58,5 @@ extern "C" {
*/
extern int mca_pcm_base_output;
extern ompi_list_t mca_pcm_base_components_available;
extern mca_pcm_base_component_t mca_pcm_base_selected_component;
extern mca_pcm_base_module_t mca_pcm;
#endif /* MCA_PCM_BASE_H */

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

@ -23,9 +23,7 @@
* Global variables
*/
int mca_pcm_base_output = 0;
mca_pcm_base_module_t mca_pcm;
ompi_list_t mca_pcm_base_components_available;
mca_pcm_base_component_t mca_pcm_base_selected_component;
/**

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

@ -12,123 +12,156 @@
#include "mca/base/base.h"
#include "mca/pcm/pcm.h"
#include "mca/pcm/base/base.h"
#include "class/ompi_list.h"
struct avail_module_t {
ompi_list_item_t super;
mca_pcm_base_module_t *module;
int priority;
bool user_threads;
bool hidden_threads;
};
typedef struct avail_module_t avail_module_t;
OBJ_CLASS_INSTANCE(avail_module_t, ompi_list_item_t, NULL, NULL);
/* insert into the list sorted on priority */
static void
insert_module(ompi_list_t *avail_modules, avail_module_t *module)
{
ompi_list_item_t *item;
avail_module_t *module_item;
for (item = ompi_list_get_first(avail_modules) ;
item != ompi_list_get_end(avail_modules) ;
item = ompi_list_get_next(item) ) {
module_item = (avail_module_t*) item;
if (module->priority >= module_item->priority) break;
}
ompi_list_insert_pos(avail_modules, item, (ompi_list_item_t*) module);
}
/**
* 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.
* priorities. If we are runnning in multi-cell, return all available
* modules. Otherwise, rerturn module with highest priority.
*/
int mca_pcm_base_select(bool *allow_multi_user_threads,
bool *have_hidden_threads)
int
mca_pcm_base_select(bool *allow_multi_user_threads,
bool *have_hidden_threads,
int constraints,
mca_pcm_base_module_t ***modules,
int *modules_len)
{
int priority, best_priority;
bool user_threads, hidden_threads;
bool best_user_threads, best_hidden_threads;
ompi_list_item_t *item;
mca_base_component_list_item_t *cli;
mca_pcm_base_component_t *component, *best_component;
mca_pcm_base_module_t *module, *best_module;
extern ompi_list_t mca_pcm_base_components_available;
int priority;
bool user_threads, hidden_threads;
avail_module_t *avail_module;
ompi_list_item_t *item;
mca_base_component_list_item_t *cli;
mca_pcm_base_component_t *component;
mca_pcm_base_module_t *module;
extern ompi_list_t mca_pcm_base_components_available;
ompi_list_t avail_module_list, unused_module_list;
int i;
ompi_output_verbose(10, mca_pcm_base_output,
"pcm: base: select: starting selection code");
ompi_output_verbose(10, mca_pcm_base_output,
"pcm: base: select: starting select code");
/* Traverse the list of available components; call their init
functions. */
OBJ_CONSTRUCT(&avail_module_list, ompi_list_t);
OBJ_CONSTRUCT(&unused_module_list, ompi_list_t);
best_priority = -1;
best_component = NULL;
for (item = ompi_list_get_first(&mca_pcm_base_components_available);
ompi_list_get_end(&mca_pcm_base_components_available) != item;
item = ompi_list_get_next(item)) {
cli = (mca_base_component_list_item_t *) item;
component = (mca_pcm_base_component_t *) cli->cli_component;
/* traverse the list of available components ; call their init functions */
for (item = ompi_list_get_first(&mca_pcm_base_components_available);
ompi_list_get_end(&mca_pcm_base_components_available) != item;
item = ompi_list_get_next(item)) {
cli = (mca_base_component_list_item_t *) item;
component = (mca_pcm_base_component_t *) cli->cli_component;
ompi_output_verbose(10, mca_pcm_base_output,
"pcm: base: select: initializing %s component %s",
component->pcm_version.mca_type_name,
component->pcm_version.mca_component_name);
if (NULL == component->pcm_init) {
ompi_output_verbose(10, mca_pcm_base_output,
"pcm: base: select: "
"no init function; ignoring component");
} else {
module = component->pcm_init(&priority, &user_threads, &hidden_threads);
if (NULL == module) {
ompi_output_verbose(10, mca_pcm_base_output,
"pcm: base: select: init returned failure");
} else {
ompi_output_verbose(10, mca_pcm_base_output,
"pcm: base: select: init returned priority %d",
priority);
if (priority > best_priority) {
best_priority = priority;
best_user_threads = user_threads;
best_hidden_threads = hidden_threads;
best_component = component;
best_module = module;
}
}
}
}
hidden_threads = user_threads = false;
priority = 0;
/* Finished querying all components. Check for the bozo case. */
if (NULL == best_component) {
/* JMS Replace with show_help */
ompi_abort(1, "No PCM component available. This shouldn't happen.");
}
/* Finalize all non-selected components */
for (item = ompi_list_get_first(&mca_pcm_base_components_available);
ompi_list_get_end(&mca_pcm_base_components_available) != item;
item = ompi_list_get_next(item)) {
cli = (mca_base_component_list_item_t *) item;
component = (mca_pcm_base_component_t *) cli->cli_component;
if (component != best_component) {
/* Finalize */
if (NULL != component->pcm_finalize) {
/* Blatently ignore the return code (what would we do to
recover, anyway? This component is going away, so errors
don't matter anymore) */
component->pcm_finalize();
ompi_output_verbose(10, mca_pcm_base_output,
"pcm: base: select: component %s finalized",
component->pcm_version.mca_component_name);
}
"pcm: base: select: initializing %s component %s",
component->pcm_version.mca_type_name,
component->pcm_version.mca_component_name);
if (NULL == component->pcm_init) {
ompi_output_verbose(10, mca_pcm_base_output,
"pcm: base: select: "
"no init function; ignoring component");
} else {
module = component->pcm_init(&priority, &user_threads,
&hidden_threads, constraints);
if (NULL == module) {
ompi_output_verbose(10, mca_pcm_base_output,
"pcm: base: select: init returned failure");
} else {
ompi_output_verbose(10, mca_pcm_base_output,
"pcm: base: select: init returned priority %d",
priority);
avail_module = OBJ_NEW(avail_module_t);
avail_module->priority = priority;
avail_module->hidden_threads = hidden_threads;
avail_module->user_threads = user_threads;
avail_module->module = module;
insert_module(&avail_module_list, avail_module);
}
}
}
}
/* This base function closes, unloads, and removes from the
available list all unselected components. The available list will
contain only the selected component. */
/* Finished querying all components. Check for the bozo case */
if (0 == ompi_list_get_size(&avail_module_list)) {
/* JMS Replace with show_help */
ompi_abort(1, "No PCM component available. This shouldn't happen.");
}
mca_base_components_close(mca_pcm_base_output,
&mca_pcm_base_components_available,
(mca_base_component_t *) best_component);
/* Deal with multicell / make our priority choice */
if (0 == (constraints & OMPI_RTE_SPAWN_MULTI_CELL)) {
/* kick out all but the top */
ompi_list_splice(&unused_module_list,
ompi_list_get_end(&unused_module_list),
&avail_module_list,
ompi_list_get_next(ompi_list_get_first(&avail_module_list)),
ompi_list_get_end(&avail_module_list));
}
/* Finalize all non-selected components */
for (item = ompi_list_get_first(&unused_module_list) ;
item != ompi_list_get_end(&unused_module_list) ;
item = ompi_list_get_next(item) ) {
}
/* Save the winner */
while (NULL != (item = ompi_list_remove_first(&unused_module_list))) {
avail_module = (avail_module_t*) item;
avail_module->module->pcm_finalize(avail_module->module);
OBJ_RELEASE(item);
}
mca_pcm_base_selected_component = *best_component;
mca_pcm = *best_module;
*allow_multi_user_threads = best_user_threads;
*have_hidden_threads = best_hidden_threads;
ompi_output_verbose(5, mca_pcm_base_output,
"pcm: base: select: component %s selected and initialized",
best_component->pcm_version.mca_component_name);
/* put the created guys in their place... */
*modules_len = ompi_list_get_size(&avail_module_list);
*modules = malloc(sizeof(mca_pcm_base_module_t*) * *modules_len);
if (*modules == NULL) return OMPI_ERROR;
ompi_output_verbose(10, mca_pcm_base_output,
"pcm: base: select: completed");
/* All done */
i = 0;
while (NULL != (item = ompi_list_remove_first(&avail_module_list))) {
avail_module = (avail_module_t*) item;
(*modules)[i] = avail_module->module;
++i;
OBJ_RELEASE(item);
}
return OMPI_SUCCESS;
/* All done */
OBJ_DESTRUCT(&unused_module_list);
OBJ_DESTRUCT(&avail_module_list);
return OMPI_SUCCESS;
}

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

@ -17,7 +17,7 @@
#include "mca/llm/base/base_internal.h"
char *
mca_pcm_base_no_unique_name(void)
mca_pcm_base_no_unique_name(struct mca_pcm_base_module_1_0_0_t* me)
{
return strdup("0");
}

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

@ -50,6 +50,7 @@ OBJ_CLASS_INSTANCE(
*/
ompi_list_t* mca_pcm_ompid_allocate_resources(
struct mca_pcm_base_module_1_0_0_t* me,
mca_ns_base_jobid_t jobid,
int nodes,
int procs)
@ -116,7 +117,7 @@ ompi_list_t* mca_pcm_ompid_allocate_resources(
* @return True/False
*/
bool mca_pcm_ompid_can_spawn(void)
bool mca_pcm_ompid_can_spawn(struct mca_pcm_base_module_1_0_0_t* me)
{
return true;
}
@ -131,6 +132,7 @@ bool mca_pcm_ompid_can_spawn(void)
*/
int mca_pcm_ompid_spawn_procs(
struct mca_pcm_base_module_1_0_0_t* me,
mca_ns_base_jobid_t jobid,
ompi_list_t *schedule_list)
{

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

@ -30,9 +30,10 @@ OBJ_CLASS_DECLARATION(mca_pcm_ompid_node_t);
struct mca_pcm_base_module_1_0_0_t* mca_pcm_ompid_init(
int *priority,
bool *allow_multi_user_threads,
bool *have_hidden_threads);
bool *have_hidden_threads,
int constraints);
int mca_pcm_ompid_finalize(void);
int mca_pcm_ompid_finalize(struct mca_pcm_base_module_1_0_0_t* me);
/**
@ -59,6 +60,7 @@ int mca_pcm_ompid_finalize(void);
*/
ompi_list_t* mca_pcm_ompid_allocate_resources(
struct mca_pcm_base_module_1_0_0_t* me,
mca_ns_base_jobid_t jobid,
int nodes,
int procs);
@ -71,7 +73,7 @@ ompi_list_t* mca_pcm_ompid_allocate_resources(
* @return True/False
*/
bool mca_pcm_ompid_can_spawn(void);
bool mca_pcm_ompid_can_spawn(struct mca_pcm_base_module_1_0_0_t* me);
/**
* Spawn a job
@ -83,6 +85,7 @@ bool mca_pcm_ompid_can_spawn(void);
*/
int mca_pcm_ompid_spawn_procs(
struct mca_pcm_base_module_1_0_0_t* me,
mca_ns_base_jobid_t jobid,
ompi_list_t *schedule_list);

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

@ -37,8 +37,7 @@ mca_pcm_base_component_1_0_0_t mca_pcm_ompid_component = {
{
false /* checkpoint / restart */
},
mca_pcm_ompid_init, /* component init */
mca_pcm_ompid_finalize
mca_pcm_ompid_init /* component init */
};
@ -49,7 +48,8 @@ struct mca_pcm_base_module_1_0_0_t mca_pcm_ompid_1_0_0 = {
mca_pcm_ompid_spawn_procs, /* spawn_procs */
NULL, /* kill_proc */
NULL, /* kill_job */
NULL /* deallocate_resources */
NULL, /* deallocate_resources */
mca_pcm_ompid_finalize
};
@ -69,13 +69,14 @@ struct mca_pcm_base_module_1_0_0_t *
mca_pcm_ompid_init(
int *priority,
bool *allow_multi_user_threads,
bool *have_hidden_threads)
bool *have_hidden_threads,
int constraints)
{
return NULL;
}
int mca_pcm_ompid_finalize(void)
int mca_pcm_ompid_finalize(struct mca_pcm_base_module_1_0_0_t* me)
{
return OMPI_SUCCESS;
}

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

@ -77,9 +77,6 @@
* Called by the MCA framework to initialize the component. Will
* be called exactly once in the lifetime of the process.
*
* @param active_pcm (IN) Name of the currently active PCM module,
* as it might be useful in determining
* useability.
* @param priority (OUT) Relative priority or ranking use by MCA to
* select a module.
* @param allow_multiple_user_threads (OUT) Whether this module can
@ -88,11 +85,15 @@
* from MPI-land).
* @param have_hidden_threads (OUT) Whether this module needs to start
* a background thread for operation.
* @param constrains (IN) Bit-wise mask of constraints put on the PCM.
* List of available constants is in the run-time interface -
* constants start with \c OMPI_RTE_SPAWN_.
*/
typedef struct mca_pcm_base_module_1_0_0_t*
(*mca_pcm_base_component_init_fn_t)(int *priority,
bool *allow_multiple_user_threads,
bool *have_hidden_threads);
bool *have_hidden_threads,
int constraints);
/**
@ -100,8 +101,11 @@ typedef struct mca_pcm_base_module_1_0_0_t*
*
* Called by the MCA framework to finalize the component. Will be
* called once per successful call to pcm_base_compoenent_init.
*
* @param me (IN) Pointer to the module being finalized
*/
typedef int (*mca_pcm_base_component_finalize_fn_t)(void);
typedef int (*mca_pcm_base_component_finalize_fn_t)(struct mca_pcm_base_module_1_0_0_t* me);
/**
@ -115,7 +119,6 @@ struct mca_pcm_base_component_1_0_0_t {
mca_base_component_t pcm_version;
mca_base_component_data_1_0_0_t pcm_data;
mca_pcm_base_component_init_fn_t pcm_init;
mca_pcm_base_component_finalize_fn_t pcm_finalize;
};
typedef struct mca_pcm_base_component_1_0_0_t mca_pcm_base_component_1_0_0_t;
typedef mca_pcm_base_component_1_0_0_t mca_pcm_base_component_t;
@ -139,7 +142,7 @@ typedef mca_pcm_base_component_1_0_0_t mca_pcm_base_component_t;
* non-null otherwize
*/
typedef char *
(*mca_pcm_base_get_unique_name_fn_t)(void);
(*mca_pcm_base_get_unique_name_fn_t)(struct mca_pcm_base_module_1_0_0_t* me);
@ -166,7 +169,8 @@ typedef char *
* the allocated resources.
*/
typedef ompi_list_t*
(*mca_pcm_base_allocate_resources_fn_t)(mca_ns_base_jobid_t jobid,
(*mca_pcm_base_allocate_resources_fn_t)(struct mca_pcm_base_module_1_0_0_t* me,
mca_ns_base_jobid_t jobid,
int nodes,
int procs);
@ -179,7 +183,7 @@ typedef ompi_list_t*
*/
typedef bool
(*mca_pcm_base_can_spawn_fn_t)(void);
(*mca_pcm_base_can_spawn_fn_t)(struct mca_pcm_base_module_1_0_0_t* me);
/**
@ -191,7 +195,8 @@ typedef bool
* and location information.
*/
typedef int
(*mca_pcm_base_spawn_procs_fn_t)(mca_ns_base_jobid_t jobid,
(*mca_pcm_base_spawn_procs_fn_t)(struct mca_pcm_base_module_1_0_0_t* me,
mca_ns_base_jobid_t jobid,
ompi_list_t *schedule_list);
@ -206,7 +211,8 @@ typedef int
* processes (0 will be same as a "kill <pid>"
*/
typedef int
(*mca_pcm_base_kill_proc_fn_t)(ompi_process_name_t *name, int flags);
(*mca_pcm_base_kill_proc_fn_t)(struct mca_pcm_base_module_1_0_0_t* me,
ompi_process_name_t *name, int flags);
/**
@ -222,7 +228,8 @@ typedef int
* processes (0 will be same as a "kill <pid>"
*/
typedef int
(*mca_pcm_base_kill_job_fn_t)(mca_ns_base_jobid_t jobid, int flags);
(*mca_pcm_base_kill_job_fn_t)(struct mca_pcm_base_module_1_0_0_t* me,
mca_ns_base_jobid_t jobid, int flags);
/**
@ -235,7 +242,8 @@ typedef int
* All associated memory will be freed as appropriate.
*/
typedef int
(*mca_pcm_base_deallocate_resources_fn_t)(mca_ns_base_jobid_t jobid,
(*mca_pcm_base_deallocate_resources_fn_t)(struct mca_pcm_base_module_1_0_0_t* me,
mca_ns_base_jobid_t jobid,
ompi_list_t *nodelist);
@ -253,6 +261,7 @@ struct mca_pcm_base_module_1_0_0_t {
mca_pcm_base_kill_proc_fn_t pcm_kill_proc;
mca_pcm_base_kill_job_fn_t pcm_kill_job;
mca_pcm_base_deallocate_resources_fn_t pcm_deallocate_resources;
mca_pcm_base_component_finalize_fn_t pcm_finalize;
};
typedef struct mca_pcm_base_module_1_0_0_t mca_pcm_base_module_1_0_0_t;
typedef struct mca_pcm_base_module_1_0_0_t mca_pcm_base_module_t;

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

@ -126,7 +126,8 @@ remove_started_pid(pid_t pid)
/* ok, this is fairly simple in the RMS world */
ompi_list_t *
mca_pcm_rms_allocate_resources(mca_ns_base_jobid_t jobid,
mca_pcm_rms_allocate_resources(struct mca_pcm_base_module_1_0_0_t* me,
mca_ns_base_jobid_t jobid,
int nodes, int procs)
{
ompi_list_t *ret;
@ -166,7 +167,7 @@ mca_pcm_rms_allocate_resources(mca_ns_base_jobid_t jobid,
bool
mca_pcm_rms_can_spawn(void)
mca_pcm_rms_can_spawn(struct mca_pcm_base_module_1_0_0_t* me)
{
/* it looks like a prun'd job can call prun again... let's see
what happens for now.. */
@ -175,7 +176,8 @@ mca_pcm_rms_can_spawn(void)
int
mca_pcm_rms_spawn_procs(mca_ns_base_jobid_t jobid, ompi_list_t *schedlist)
mca_pcm_rms_spawn_procs(struct mca_pcm_base_module_1_0_0_t* me,
mca_ns_base_jobid_t jobid, ompi_list_t *schedlist)
{
ompi_rte_node_allocation_t *nodes;
ompi_rte_node_schedule_t *sched;
@ -277,7 +279,8 @@ mca_pcm_rms_spawn_procs(mca_ns_base_jobid_t jobid, ompi_list_t *schedlist)
int
mca_pcm_rms_kill_proc(ompi_process_name_t *name, int flags)
mca_pcm_rms_kill_proc(struct mca_pcm_base_module_1_0_0_t* me,
ompi_process_name_t *name, int flags)
{
mca_pcm_rms_job_item_t *job = get_job_item(ns_base_get_jobid(name));
pid_t doomed;
@ -299,7 +302,8 @@ mca_pcm_rms_kill_proc(ompi_process_name_t *name, int flags)
int
mca_pcm_rms_kill_job(mca_ns_base_jobid_t jobid, int flags)
mca_pcm_rms_kill_job(struct mca_pcm_base_module_1_0_0_t* me,
mca_ns_base_jobid_t jobid, int flags)
{
mca_pcm_rms_job_item_t *job = get_job_item(jobid);
ompi_list_item_t *item;
@ -321,7 +325,8 @@ mca_pcm_rms_kill_job(mca_ns_base_jobid_t jobid, int flags)
int
mca_pcm_rms_deallocate_resources(mca_ns_base_jobid_t jobid,
mca_pcm_rms_deallocate_resources(struct mca_pcm_base_module_1_0_0_t* me,
mca_ns_base_jobid_t jobid,
ompi_list_t *nodelist)
{
mca_pcm_rms_job_item_t *job;

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

@ -29,20 +29,26 @@ extern "C" {
* Startup / Shutdown
*/
struct mca_pcm_base_module_1_0_0_t* mca_pcm_rms_init(int *priority,
bool *allow_multi_user_threads,
bool *have_hidden_threads);
int mca_pcm_rms_finalize(void);
bool *allow_multi_user_threads,
bool *have_hidden_threads,
int constraints);
int mca_pcm_rms_finalize(struct mca_pcm_base_module_1_0_0_t* me);
/*
* Interface
*/
ompi_list_t* mca_pcm_rms_allocate_resources(mca_ns_base_jobid_t jobid,
ompi_list_t* mca_pcm_rms_allocate_resources(struct mca_pcm_base_module_1_0_0_t* me,
mca_ns_base_jobid_t jobid,
int nodes, int procs);
bool mca_pcm_rms_can_spawn(void);
int mca_pcm_rms_spawn_procs(mca_ns_base_jobid_t jobid, ompi_list_t *schedule_list);
int mca_pcm_rms_kill_proc(ompi_process_name_t *name, int flags);
int mca_pcm_rms_kill_job(mca_ns_base_jobid_t jobid, int flags);
int mca_pcm_rms_deallocate_resources(mca_ns_base_jobid_t jobid,
bool mca_pcm_rms_can_spawn(struct mca_pcm_base_module_1_0_0_t* me);
int mca_pcm_rms_spawn_procs(struct mca_pcm_base_module_1_0_0_t* me,
mca_ns_base_jobid_t jobid, ompi_list_t *schedule_list);
int mca_pcm_rms_kill_proc(struct mca_pcm_base_module_1_0_0_t* me,
ompi_process_name_t *name, int flags);
int mca_pcm_rms_kill_job(struct mca_pcm_base_module_1_0_0_t* me,
mca_ns_base_jobid_t jobid, int flags);
int mca_pcm_rms_deallocate_resources(struct mca_pcm_base_module_1_0_0_t* me,
mca_ns_base_jobid_t jobid,
ompi_list_t *nodelist);
struct mca_pcm_rms_pids_t {

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

@ -43,8 +43,7 @@ mca_pcm_base_component_1_0_0_t mca_pcm_rms_component = {
{
false /* checkpoint / restart */
},
mca_pcm_rms_init, /* component init */
mca_pcm_rms_finalize
mca_pcm_rms_init /* component init */
};
@ -55,7 +54,8 @@ struct mca_pcm_base_module_1_0_0_t mca_pcm_rms_1_0_0 = {
mca_pcm_rms_spawn_procs,
mca_pcm_rms_kill_proc,
mca_pcm_rms_kill_job,
mca_pcm_rms_deallocate_resources
mca_pcm_rms_deallocate_resources,
mca_pcm_rms_finalize
};
@ -116,8 +116,9 @@ mca_pcm_rms_component_close(void)
mca_pcm_base_module_t*
mca_pcm_rms_init(int *priority,
bool *allow_multi_user_threads,
bool *have_hidden_threads)
bool *allow_multi_user_threads,
bool *have_hidden_threads,
int constraints)
{
int debug;
char *prun;
@ -128,7 +129,7 @@ mca_pcm_rms_init(int *priority,
mca_base_param_lookup_int(mca_pcm_rms_param_priority, priority);
mca_base_param_lookup_int(mca_pcm_rms_param_use_ns, &mca_pcm_use_ns);
mca_base_param_lookup_int(mca_pcm_rms_param_use_ns, &mca_pcm_rms_use_ns);
*allow_multi_user_threads = false;
*have_hidden_threads = false;
@ -142,7 +143,7 @@ mca_pcm_rms_init(int *priority,
int
mca_pcm_rms_finalize(void)
mca_pcm_rms_finalize(struct mca_pcm_base_module_1_0_0_t* me)
{
if (mca_pcm_rms_output > 0) {
ompi_output_close(mca_pcm_rms_output);

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

@ -7,6 +7,7 @@ include $(top_ompi_srcdir)/config/Makefile.options
noinst_LTLIBRARIES = libmca_pcm_rsh.la
libmca_pcm_rsh_la_SOURCES = \
pcm_rsh.h \
pcm_rsh_allocate.c \
pcm_rsh_component.c \
pcm_rsh_kill.c \
pcm_rsh_spawn.c

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

@ -8,6 +8,7 @@
#include "mca/pcm/pcm.h"
#include "include/types.h"
#include "mca/llm/llm.h"
#include <sys/types.h>
@ -28,17 +29,27 @@ extern "C" {
* Startup / Shutdown
*/
struct mca_pcm_base_module_1_0_0_t* mca_pcm_rsh_init(int *priority,
bool *allow_multi_user_threads,
bool *have_hidden_threads);
int mca_pcm_rsh_finalize(void);
bool *allow_multi_user_threads,
bool *have_hidden_threads,
int constraints);
int mca_pcm_rsh_finalize(struct mca_pcm_base_module_1_0_0_t* me);
/*
* Interface
*/
bool mca_pcm_rsh_can_spawn(void);
int mca_pcm_rsh_spawn_procs(mca_ns_base_jobid_t jobid, ompi_list_t *schedule_list);
int mca_pcm_rsh_kill_proc(ompi_process_name_t *name, int flags);
int mca_pcm_rsh_kill_job(mca_ns_base_jobid_t jobid, int flags);
ompi_list_t* mca_pcm_rsh_allocate_resources(struct mca_pcm_base_module_1_0_0_t* me,
mca_ns_base_jobid_t jobid,
int nodes, int procs);
bool mca_pcm_rsh_can_spawn(struct mca_pcm_base_module_1_0_0_t* me);
int mca_pcm_rsh_spawn_procs(struct mca_pcm_base_module_1_0_0_t* me,
mca_ns_base_jobid_t jobid, ompi_list_t *schedule_list);
int mca_pcm_rsh_kill_proc(struct mca_pcm_base_module_1_0_0_t* me,
ompi_process_name_t *name, int flags);
int mca_pcm_rsh_kill_job(struct mca_pcm_base_module_1_0_0_t* me,
mca_ns_base_jobid_t jobid, int flags);
int mca_pcm_rsh_deallocate_resources(struct mca_pcm_base_module_1_0_0_t* me,
mca_ns_base_jobid_t jobid,
ompi_list_t *nodelist);
#ifdef __cplusplus
}
@ -59,5 +70,6 @@ extern char *mca_pcm_rsh_agent;
extern int mca_pcm_rsh_output;
extern int mca_pcm_rsh_use_ns;
extern mca_llm_base_module_t mca_pcm_rsh_llm;
#endif /* MCA_PCM_RSH_H_ */

31
src/mca/pcm/rsh/src/pcm_rsh_allocate.c Обычный файл
Просмотреть файл

@ -0,0 +1,31 @@
/* -*- C -*-
*
* $HEADER$
*
*/
#include "ompi_config.h"
#include "include/constants.h"
#include "mca/pcm/pcm.h"
#include "mca/pcm/base/base.h"
#include "mca/pcm/rsh/src/pcm_rsh.h"
#include "mca/llm/llm.h"
ompi_list_t *
mca_pcm_rsh_allocate_resources(struct mca_pcm_base_module_1_0_0_t* me,
mca_ns_base_jobid_t jobid,
int nodes, int procs)
{
return mca_pcm_rsh_llm.llm_allocate_resources(jobid, nodes, procs);
}
int
mca_pcm_rsh_deallocate_resources(struct mca_pcm_base_module_1_0_0_t* me,
mca_ns_base_jobid_t jobid,
ompi_list_t *nodelist)
{
return mca_pcm_rsh_llm.llm_deallocate_resources(jobid, nodelist);
}

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

@ -41,19 +41,19 @@ mca_pcm_base_component_1_0_0_t mca_pcm_rsh_component = {
{
false /* checkpoint / restart */
},
mca_pcm_rsh_init, /* component init */
mca_pcm_rsh_finalize
mca_pcm_rsh_init /* component init */
};
struct mca_pcm_base_module_1_0_0_t mca_pcm_rsh_1_0_0 = {
mca_pcm_base_no_unique_name,
NULL,
mca_pcm_rsh_allocate_resources,
mca_pcm_rsh_can_spawn,
mca_pcm_rsh_spawn_procs,
mca_pcm_rsh_kill_proc,
mca_pcm_rsh_kill_job,
NULL
mca_pcm_rsh_deallocate_resources,
mca_pcm_rsh_finalize
};
@ -99,7 +99,7 @@ char *mca_pcm_rsh_agent;
int mca_pcm_rsh_output = 0;
int mca_pcm_rsh_use_ns;
static mca_llm_base_module_t mca_pcm_rsh_llm;
mca_llm_base_module_t mca_pcm_rsh_llm;
int
mca_pcm_rsh_component_open(void)
@ -137,7 +137,8 @@ mca_pcm_rsh_component_close(void)
mca_pcm_base_module_t*
mca_pcm_rsh_init(int *priority,
bool *allow_multi_user_threads,
bool *have_hidden_threads)
bool *have_hidden_threads,
int constraints)
{
int debug;
int ret;
@ -173,14 +174,6 @@ mca_pcm_rsh_init(int *priority,
return NULL;
}
/* copy over the function pointers */
mca_pcm_rsh_1_0_0.pcm_allocate_resources =
(mca_pcm_base_allocate_resources_fn_t)
mca_pcm_rsh_llm.llm_allocate_resources;
mca_pcm_rsh_1_0_0.pcm_deallocate_resources =
(mca_pcm_base_deallocate_resources_fn_t)
mca_pcm_rsh_llm.llm_deallocate_resources;
/* DO SOME PARAM "FIXING" */
/* BWB - remove param fixing before 1.0 */
if (0 == mca_pcm_rsh_no_profile) {
@ -197,16 +190,11 @@ mca_pcm_rsh_init(int *priority,
int
mca_pcm_rsh_finalize(void)
mca_pcm_rsh_finalize(struct mca_pcm_base_module_1_0_0_t* me)
{
if (mca_pcm_rsh_output > 0) {
ompi_output_close(mca_pcm_rsh_output);
}
if (NULL == mca_pcm_rsh_1_0_0.pcm_allocate_resources) {
mca_pcm_rsh_1_0_0.pcm_allocate_resources = NULL;
mca_pcm_rsh_1_0_0.pcm_deallocate_resources = NULL;
}
return OMPI_SUCCESS;
}

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

@ -12,14 +12,16 @@
int
mca_pcm_rsh_kill_proc(ompi_process_name_t *name, int flags)
mca_pcm_rsh_kill_proc(struct mca_pcm_base_module_1_0_0_t* me,
ompi_process_name_t *name, int flags)
{
return OMPI_ERROR;
}
int
mca_pcm_rsh_kill_job(mca_ns_base_jobid_t jobid, int flags)
mca_pcm_rsh_kill_job(struct mca_pcm_base_module_1_0_0_t* me,
mca_ns_base_jobid_t jobid, int flags)
{
return OMPI_ERROR;
}

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

@ -44,7 +44,7 @@ static int internal_spawn_proc(mca_ns_base_jobid_t jobid, ompi_rte_node_schedule
bool
mca_pcm_rsh_can_spawn(void)
mca_pcm_rsh_can_spawn(struct mca_pcm_base_module_1_0_0_t* me)
{
/* we can always try to rsh some more... Might not always work as
* the caller hopes
@ -54,7 +54,8 @@ mca_pcm_rsh_can_spawn(void)
int
mca_pcm_rsh_spawn_procs(mca_ns_base_jobid_t jobid, ompi_list_t *schedlist)
mca_pcm_rsh_spawn_procs(struct mca_pcm_base_module_1_0_0_t* me,
mca_ns_base_jobid_t jobid, ompi_list_t *schedlist)
{
ompi_list_item_t *sched_item, *node_item, *host_item;
ompi_rte_node_schedule_t *sched;

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

@ -27,10 +27,14 @@
#include "runtime/runtime.h"
mca_pcm_base_module_t *mca_pcm;
int ompi_rte_init_stage2(bool *allow_multi_user_threads, bool *have_hidden_threads)
{
int ret;
bool user_threads, hidden_threads;
mca_pcm_base_module_t **pcm_modules;
int pcm_modules_len;
/*
* Name Server
@ -90,11 +94,19 @@ int ompi_rte_init_stage2(bool *allow_multi_user_threads, bool *have_hidden_threa
user_threads = true;
hidden_threads = false;
if (OMPI_SUCCESS != (ret = mca_pcm_base_select(&user_threads,
&hidden_threads))) {
&hidden_threads, 0,
&pcm_modules,
&pcm_modules_len))) {
printf("show_help: ompi_rte_init failed in pcm_base_select\n");
/* JMS show_help */
return ret;
}
if (pcm_modules_len != 1) {
printf("show_help: unexpectedly high return from pcm_modules_len\n");
return -1;
}
mca_pcm = pcm_modules[0];
free(pcm_modules);
*allow_multi_user_threads &= user_threads;
*have_hidden_threads |= hidden_threads;

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

@ -9,25 +9,25 @@
#include "runtime/runtime_types.h"
#include "mca/pcm/pcm.h"
extern mca_pcm_base_module_t mca_pcm;
extern mca_pcm_base_module_t *mca_pcm;
ompi_list_t*
ompi_rte_allocate_resources(mca_ns_base_jobid_t jobid, int nodes, int procs)
{
if (NULL == mca_pcm.pcm_allocate_resources) {
if (NULL == mca_pcm->pcm_allocate_resources) {
return NULL;
}
return mca_pcm.pcm_allocate_resources(jobid, nodes, procs);
return mca_pcm->pcm_allocate_resources(mca_pcm, jobid, nodes, procs);
}
int
ompi_rte_deallocate_resources(mca_ns_base_jobid_t jobid, ompi_list_t *nodelist)
{
if (NULL == mca_pcm.pcm_deallocate_resources) {
if (NULL == mca_pcm->pcm_deallocate_resources) {
return OMPI_ERROR;
}
return mca_pcm.pcm_deallocate_resources(jobid, nodelist);
return mca_pcm->pcm_deallocate_resources(mca_pcm, jobid, nodelist);
}

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

@ -11,27 +11,27 @@
#include "mca/pcmclient/pcmclient.h"
#include "mca/pcmclient/base/base.h"
extern mca_pcm_base_module_t mca_pcm;
extern mca_pcm_base_module_t *mca_pcm;
bool
ompi_rte_can_spawn(void)
{
if (NULL == mca_pcm.pcm_can_spawn) {
if (NULL == mca_pcm->pcm_can_spawn) {
return OMPI_ERROR;
}
return mca_pcm.pcm_can_spawn();
return mca_pcm->pcm_can_spawn(mca_pcm);
}
int
ompi_rte_spawn_procs(mca_ns_base_jobid_t jobid, ompi_list_t *schedule_list)
{
if (NULL == mca_pcm.pcm_spawn_procs) {
if (NULL == mca_pcm->pcm_spawn_procs) {
return OMPI_ERROR;
}
return mca_pcm.pcm_spawn_procs(jobid, schedule_list);
return mca_pcm->pcm_spawn_procs(mca_pcm, jobid, schedule_list);
}
@ -60,20 +60,20 @@ ompi_rte_get_peers(ompi_process_name_t **peers, size_t *npeers)
int
ompi_rte_kill_proc(ompi_process_name_t *name, int flags)
{
if (NULL == mca_pcm.pcm_kill_proc) {
if (NULL == mca_pcm->pcm_kill_proc) {
return OMPI_ERROR;
}
return mca_pcm.pcm_kill_proc(name, flags);
return mca_pcm->pcm_kill_proc(mca_pcm, name, flags);
}
int
ompi_rte_kill_job(mca_ns_base_jobid_t jobid, int flags)
{
if (NULL == mca_pcm.pcm_kill_job) {
if (NULL == mca_pcm->pcm_kill_job) {
return OMPI_ERROR;
}
return mca_pcm.pcm_kill_job(jobid, flags);
return mca_pcm->pcm_kill_job(mca_pcm, jobid, flags);
}

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

@ -22,6 +22,8 @@
mpiruntime/mpiruntime.h directly */
#include "mpi/runtime/mpiruntime.h"
#define OMPI_RTE_SPAWN_MULTI_CELL 0x0001
#ifdef __cplusplus
extern "C" {
#endif