* move the unique_id code from the module to component level, since we don't
really want to fire up the modules early just to get the unique id and it will cause all kinds of fun along the way that we don't want. Update the pcm components to match (keeping in mind none of them can provide any extra info (although some day, I'm sure the ompid one could do so) Add a base function to access the unique id info. This commit was SVN r2619.
Этот коммит содержится в:
родитель
0ed4c8f663
Коммит
7127f7f5c3
@ -29,8 +29,6 @@ extern "C" {
|
||||
|
||||
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,
|
||||
ompi_rte_node_schedule_t *sched,
|
||||
@ -48,6 +46,8 @@ extern "C" {
|
||||
|
||||
char* mca_pcm_base_get_username(mca_llm_base_hostfile_node_t *node);
|
||||
|
||||
char *mca_pcm_base_get_unique_id(void);
|
||||
|
||||
#if defined(c_plusplus) || defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
@ -15,11 +15,49 @@
|
||||
#include "mca/pcm/base/base.h"
|
||||
#include "mca/llm/base/base.h"
|
||||
#include "mca/llm/base/base_internal.h"
|
||||
#include "mca/mca.h"
|
||||
#include "mca/base/base.h"
|
||||
|
||||
char *
|
||||
mca_pcm_base_no_unique_name(struct mca_pcm_base_module_1_0_0_t* me)
|
||||
|
||||
char*
|
||||
mca_pcm_base_get_unique_id(void)
|
||||
{
|
||||
return strdup("0");
|
||||
extern ompi_list_t mca_pcm_base_components_available;
|
||||
ompi_list_item_t *item;
|
||||
mca_base_component_list_item_t *cli;
|
||||
mca_pcm_base_component_t *component;
|
||||
mca_pcm_base_module_t *module;
|
||||
int priority, top_priority;
|
||||
char *id, *top_id;
|
||||
int ret;
|
||||
|
||||
top_priority = -1;
|
||||
top_id = 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;
|
||||
|
||||
if (NULL == component->pcm_get_unique_id) continue;
|
||||
|
||||
priority = 0;
|
||||
id = NULL;
|
||||
|
||||
ret = component->pcm_get_unique_id(&id, &priority);
|
||||
if (OMPI_SUCCESS != ret) continue;
|
||||
|
||||
if (priority > top_priority) {
|
||||
if (NULL != top_id) free(top_id);
|
||||
top_id = id;
|
||||
top_priority = priority;
|
||||
} else {
|
||||
free(id);
|
||||
}
|
||||
}
|
||||
|
||||
return top_id;
|
||||
}
|
||||
|
||||
|
||||
|
@ -37,12 +37,12 @@ mca_pcm_base_component_1_0_0_t mca_pcm_ompid_component = {
|
||||
{
|
||||
false /* checkpoint / restart */
|
||||
},
|
||||
mca_pcm_ompid_init /* component init */
|
||||
mca_pcm_ompid_init, /* component init */
|
||||
NULL /* unique name */
|
||||
};
|
||||
|
||||
|
||||
struct mca_pcm_base_module_1_0_0_t mca_pcm_ompid_1_0_0 = {
|
||||
mca_pcm_base_no_unique_name, /* unique_string */
|
||||
mca_pcm_ompid_allocate_resources, /* allocate_resources */
|
||||
mca_pcm_ompid_can_spawn, /* can_spawn */
|
||||
mca_pcm_ompid_spawn_procs, /* spawn_procs */
|
||||
|
@ -114,17 +114,42 @@ typedef struct mca_pcm_base_module_1_0_0_t*
|
||||
typedef int (*mca_pcm_base_component_finalize_fn_t)(struct mca_pcm_base_module_1_0_0_t* me);
|
||||
|
||||
|
||||
/**
|
||||
* Return a string uniquely identifying the environment
|
||||
*
|
||||
* Return a string that provides some uniqueness that the system
|
||||
* run-time environment makes available. In RSH, this function won't
|
||||
* provide any help. In a PBS job, however, this function will return
|
||||
* the concatentaion of the PBS variables required for uniquely
|
||||
* identifying the PBS job environment (the same is true of LSF, SGE,
|
||||
* etc.).
|
||||
*
|
||||
* @param id_string (OUT) Available uniqueness string (NULL terminated)
|
||||
* @param priority (OUT) Similar to \c init priority. Used if multiple
|
||||
* components return useful information.
|
||||
*
|
||||
* @returns OMPI_SUCCESS if there is information in id_string.
|
||||
* OMPI_ERR_NOT_SUPPORTED if there is no information available.
|
||||
*
|
||||
* \note This is a component-level call, so it can (and will) be
|
||||
* called before any calls to module_init.
|
||||
*/
|
||||
typedef int
|
||||
(*mca_pcm_base_component_get_unique_id_fn_t)(char **id_string,
|
||||
int *priority);
|
||||
|
||||
|
||||
/**
|
||||
* PCM module version and interface functions
|
||||
*
|
||||
* \note the first two entries have type names that are a bit
|
||||
* misleading. The plan is to rename the mca_base_module_*
|
||||
* types in the future.
|
||||
* \note pcm_get_unique_id can be NULL if no unique information is
|
||||
* possibly going to be available from the pcm component.
|
||||
*/
|
||||
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_get_unique_id_fn_t pcm_get_unique_id;
|
||||
};
|
||||
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;
|
||||
@ -134,24 +159,6 @@ typedef mca_pcm_base_component_1_0_0_t mca_pcm_base_component_t;
|
||||
* PCM interface functions
|
||||
*/
|
||||
|
||||
/**
|
||||
* Return a string uniquely identifying the environment
|
||||
*
|
||||
* Return a string that provides some uniqueness that the system
|
||||
* run-time environment makes available. For rsh, this function will
|
||||
* return NULL as there is nothing special to be gained. In a PBS
|
||||
* job, however, this function will return the concatentaion of the
|
||||
* PBS variables required for uniquely identifying the PBS job
|
||||
* environment (the same is true of LSF, SGE, etc.).
|
||||
*
|
||||
* @param me (IN) Pointer to the module struct
|
||||
*
|
||||
* @returns NULL on error or if no uniqueness available
|
||||
* non-null otherwize
|
||||
*/
|
||||
typedef char *
|
||||
(*mca_pcm_base_get_unique_name_fn_t)(struct mca_pcm_base_module_1_0_0_t* me);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
@ -275,7 +282,6 @@ typedef int
|
||||
* pointers to the calling interface.
|
||||
*/
|
||||
struct mca_pcm_base_module_1_0_0_t {
|
||||
mca_pcm_base_get_unique_name_fn_t pcm_get_unique_name;
|
||||
mca_pcm_base_allocate_resources_fn_t pcm_allocate_resources;
|
||||
mca_pcm_base_can_spawn_fn_t pcm_can_spawn;
|
||||
mca_pcm_base_spawn_procs_fn_t pcm_spawn_procs;
|
||||
|
@ -43,12 +43,12 @@ mca_pcm_base_component_1_0_0_t mca_pcm_rms_component = {
|
||||
{
|
||||
false /* checkpoint / restart */
|
||||
},
|
||||
mca_pcm_rms_init /* component init */
|
||||
mca_pcm_rms_init, /* component init */
|
||||
NULL /* unique name */
|
||||
};
|
||||
|
||||
|
||||
struct mca_pcm_base_module_1_0_0_t mca_pcm_rms_1_0_0 = {
|
||||
mca_pcm_base_no_unique_name,
|
||||
mca_pcm_rms_allocate_resources,
|
||||
mca_pcm_rms_can_spawn,
|
||||
mca_pcm_rms_spawn_procs,
|
||||
|
@ -41,7 +41,8 @@ mca_pcm_base_component_1_0_0_t mca_pcm_rsh_component = {
|
||||
{
|
||||
false /* checkpoint / restart */
|
||||
},
|
||||
mca_pcm_rsh_init /* component init */
|
||||
mca_pcm_rsh_init, /* component init */
|
||||
NULL /* unique name */
|
||||
};
|
||||
|
||||
|
||||
@ -165,7 +166,6 @@ mca_pcm_rsh_init(int *priority,
|
||||
/*
|
||||
* fill in the function pointers
|
||||
*/
|
||||
me->super.pcm_get_unique_name = mca_pcm_base_no_unique_name;
|
||||
me->super.pcm_allocate_resources = mca_pcm_rsh_allocate_resources;
|
||||
me->super.pcm_can_spawn = mca_pcm_rsh_can_spawn;
|
||||
me->super.pcm_spawn_procs = mca_pcm_rsh_spawn_procs;
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user