1
1

Protect us against the scenario where filem is included in enable-mca-no-build

This commit was SVN r27122.
Этот коммит содержится в:
Ralph Castain 2012-08-23 13:52:06 +00:00
родитель d141d94bd7
Коммит 286c610712
4 изменённых файлов: 126 добавлений и 185 удалений

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

@ -9,6 +9,8 @@
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2012 Los Alamos National Security, LLC.
* All rights reserved
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -20,9 +22,7 @@
#include "orte_config.h"
#if !ORTE_DISABLE_FULL_SUPPORT
#include "orte/mca/rml/rml.h"
#endif
#include "orte/mca/filem/filem.h"
@ -42,7 +42,6 @@ BEGIN_C_DECLS
*/
ORTE_DECLSPEC int orte_filem_base_open(void);
#if !ORTE_DISABLE_FULL_SUPPORT
/*
* cmds for base receive
*/
@ -51,92 +50,94 @@ typedef uint8_t orte_filem_cmd_flag_t;
#define ORTE_FILEM_GET_PROC_NODE_NAME_CMD 1
#define ORTE_FILEM_GET_REMOTE_PATH_CMD 2
/**
* FileM request object maintenance functions
*/
ORTE_DECLSPEC void orte_filem_base_process_set_construct(orte_filem_base_process_set_t *obj);
ORTE_DECLSPEC void orte_filem_base_process_set_destruct( orte_filem_base_process_set_t *obj);
/**
* FileM request object maintenance functions
*/
ORTE_DECLSPEC void orte_filem_base_process_set_construct(orte_filem_base_process_set_t *obj);
ORTE_DECLSPEC void orte_filem_base_process_set_destruct( orte_filem_base_process_set_t *obj);
ORTE_DECLSPEC void orte_filem_base_file_set_construct(orte_filem_base_file_set_t *obj);
ORTE_DECLSPEC void orte_filem_base_file_set_destruct( orte_filem_base_file_set_t *obj);
ORTE_DECLSPEC void orte_filem_base_file_set_construct(orte_filem_base_file_set_t *obj);
ORTE_DECLSPEC void orte_filem_base_file_set_destruct( orte_filem_base_file_set_t *obj);
ORTE_DECLSPEC void orte_filem_base_construct(orte_filem_base_request_t *obj);
ORTE_DECLSPEC void orte_filem_base_destruct( orte_filem_base_request_t *obj);
/**
* Select an available component.
*
* @retval ORTE_SUCCESS Upon Success
* @retval ORTE_NOT_FOUND If no component can be selected
* @retval ORTE_ERROR Upon other failure
*
*/
ORTE_DECLSPEC int orte_filem_base_select(void);
/**
* Finalize the FILEM MCA framework
*
* @retval ORTE_SUCCESS Upon success
* @retval ORTE_ERROR Upon failures
*
* This function is invoked during orte_finalize();
*/
ORTE_DECLSPEC int orte_filem_base_close(void);
/**
* Globals
*/
ORTE_DECLSPEC extern int orte_filem_base_output;
ORTE_DECLSPEC extern opal_list_t orte_filem_base_components_available;
ORTE_DECLSPEC extern orte_filem_base_component_t orte_filem_base_selected_component;
ORTE_DECLSPEC extern orte_filem_base_module_t orte_filem;
ORTE_DECLSPEC extern bool orte_filem_base_is_active;
/**
* 'None' component functions
* These are to be used when no component is selected.
* They just return success, and empty strings as necessary.
*/
ORTE_DECLSPEC int orte_filem_base_none_open(void);
ORTE_DECLSPEC int orte_filem_base_none_close(void);
ORTE_DECLSPEC int orte_filem_base_none_query(mca_base_module_t **module, int *priority);
int orte_filem_base_module_init(void);
int orte_filem_base_module_finalize(void);
int orte_filem_base_none_put(orte_filem_base_request_t *request);
int orte_filem_base_none_put_nb(orte_filem_base_request_t *request);
int orte_filem_base_none_get(orte_filem_base_request_t *request);
int orte_filem_base_none_get_nb(orte_filem_base_request_t *request);
int orte_filem_base_none_rm( orte_filem_base_request_t *request);
int orte_filem_base_none_rm_nb( orte_filem_base_request_t *request);
int orte_filem_base_none_wait( orte_filem_base_request_t *request);
int orte_filem_base_none_wait_all( opal_list_t *request_list);
/**
* Some utility functions
*/
/* base comm functions */
ORTE_DECLSPEC int orte_filem_base_comm_start(void);
ORTE_DECLSPEC int orte_filem_base_comm_stop(void);
ORTE_DECLSPEC void orte_filem_base_recv(int status, orte_process_name_t* sender,
opal_buffer_t* buffer, orte_rml_tag_t tag,
void* cbdata);
ORTE_DECLSPEC void orte_filem_base_construct(orte_filem_base_request_t *obj);
ORTE_DECLSPEC void orte_filem_base_destruct( orte_filem_base_request_t *obj);
/**
* Get Node Name for an ORTE process
*/
ORTE_DECLSPEC int orte_filem_base_get_proc_node_name(orte_process_name_t *proc, char **machine_name);
ORTE_DECLSPEC int orte_filem_base_get_remote_path(char **remote_ref, orte_process_name_t *peer, int *flag);
/**
* Select an available component.
*
* @retval ORTE_SUCCESS Upon Success
* @retval ORTE_NOT_FOUND If no component can be selected
* @retval ORTE_ERROR Upon other failure
*
*/
ORTE_DECLSPEC int orte_filem_base_select(void);
/**
* Setup request structure
*/
ORTE_DECLSPEC int orte_filem_base_prepare_request(orte_filem_base_request_t *request, int move_type);
/**
* Finalize the FILEM MCA framework
*
* @retval ORTE_SUCCESS Upon success
* @retval ORTE_ERROR Upon failures
*
* This function is invoked during orte_finalize();
*/
ORTE_DECLSPEC int orte_filem_base_close(void);
#endif /* ORTE_DISABLE_FULL_SUPPORT */
/**
* Globals
*/
ORTE_DECLSPEC extern int orte_filem_base_output;
ORTE_DECLSPEC extern opal_list_t orte_filem_base_components_available;
ORTE_DECLSPEC extern orte_filem_base_component_t orte_filem_base_selected_component;
ORTE_DECLSPEC extern orte_filem_base_module_t orte_filem;
ORTE_DECLSPEC extern bool orte_filem_base_is_active;
/**
* 'None' component functions
* These are to be used when no component is selected.
* They just return success, and empty strings as necessary.
*/
ORTE_DECLSPEC int orte_filem_base_none_open(void);
ORTE_DECLSPEC int orte_filem_base_none_close(void);
ORTE_DECLSPEC int orte_filem_base_none_query(mca_base_module_t **module, int *priority);
int orte_filem_base_module_init(void);
int orte_filem_base_module_finalize(void);
int orte_filem_base_none_put(orte_filem_base_request_t *request);
int orte_filem_base_none_put_nb(orte_filem_base_request_t *request);
int orte_filem_base_none_get(orte_filem_base_request_t *request);
int orte_filem_base_none_get_nb(orte_filem_base_request_t *request);
int orte_filem_base_none_rm( orte_filem_base_request_t *request);
int orte_filem_base_none_rm_nb( orte_filem_base_request_t *request);
int orte_filem_base_none_wait( orte_filem_base_request_t *request);
int orte_filem_base_none_wait_all( opal_list_t *request_list);
int orte_filem_base_none_preposition_files(opal_list_t *file_set,
orte_filem_completion_cbfunc_t cbfunc,
void *cbdata);
int orte_filem_base_none_link_local_files(orte_job_t *jdata);
/**
* Some utility functions
*/
/* base comm functions */
ORTE_DECLSPEC int orte_filem_base_comm_start(void);
ORTE_DECLSPEC int orte_filem_base_comm_stop(void);
ORTE_DECLSPEC void orte_filem_base_recv(int status, orte_process_name_t* sender,
opal_buffer_t* buffer, orte_rml_tag_t tag,
void* cbdata);
/**
* Get Node Name for an ORTE process
*/
ORTE_DECLSPEC int orte_filem_base_get_proc_node_name(orte_process_name_t *proc, char **machine_name);
ORTE_DECLSPEC int orte_filem_base_get_remote_path(char **remote_ref, orte_process_name_t *peer, int *flag);
/**
* Setup request structure
*/
ORTE_DECLSPEC int orte_filem_base_prepare_request(orte_filem_base_request_t *request, int move_type);
END_C_DECLS

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

@ -7,6 +7,8 @@
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2012 Los Alamos National Security, LLC.
* All rights reserved
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -220,6 +222,22 @@ int orte_filem_base_none_wait_all(opal_list_t *request_list)
return ORTE_SUCCESS;
}
int orte_filem_base_none_preposition_files(opal_list_t *file_set,
orte_filem_completion_cbfunc_t cbfunc,
void *cbdata)
{
if (NULL != cbfunc) {
cbfunc(ORTE_SUCCESS, cbdata);
}
return ORTE_SUCCESS;
}
int orte_filem_base_none_link_local_files(orte_job_t *jdata)
{
return ORTE_SUCCESS;
}
/********************
* Utility functions
********************/

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

@ -7,6 +7,8 @@
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2012 Los Alamos National Security, LLC.
* All rights reserved
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -33,12 +35,18 @@
*/
ORTE_DECLSPEC int orte_filem_base_output = -1;
ORTE_DECLSPEC orte_filem_base_module_t orte_filem = {
NULL, /* filem_init */
NULL, /* filem_finalize */
NULL, /* put */
NULL, /* get */
NULL /* rm */
orte_filem_base_module_init,
orte_filem_base_module_finalize,
orte_filem_base_none_put,
orte_filem_base_none_put_nb,
orte_filem_base_none_get,
orte_filem_base_none_get_nb,
orte_filem_base_none_rm,
orte_filem_base_none_rm_nb,
orte_filem_base_none_wait,
orte_filem_base_none_wait_all,
orte_filem_base_none_preposition_files,
orte_filem_base_none_link_local_files
};
opal_list_t orte_filem_base_components_available;
orte_filem_base_component_t orte_filem_base_selected_component;
@ -50,27 +58,10 @@ bool orte_filem_base_is_active = false;
*/
int orte_filem_base_open(void)
{
char *str_value = NULL;
orte_filem_base_output = opal_output_open(NULL);
orte_filem_base_is_active = false;
/*
* Which FileM component to open
* - NULL or "" = auto-select
* - "none" = Empty component
* - ow. select that specific component
*/
mca_base_param_reg_string_name("filem", NULL,
"Which Filem component to use (empty = auto-select)",
false, false,
NULL, &str_value);
if( NULL != str_value ) {
free(str_value);
str_value = NULL;
}
/* Open up all available components */
if (OPAL_SUCCESS !=
mca_base_components_open("filem",

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

@ -7,6 +7,8 @@
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2012 Los Alamos National Security, LLC.
* All rights reserved
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -32,75 +34,11 @@
#include "orte/mca/filem/base/base.h"
static orte_filem_base_component_t none_component = {
{
ORTE_FILEM_BASE_VERSION_2_0_0,
/* Component name and version */
"none",
ORTE_MAJOR_VERSION,
ORTE_MINOR_VERSION,
ORTE_RELEASE_VERSION,
/* Component open and close functions */
orte_filem_base_none_open,
orte_filem_base_none_close,
orte_filem_base_none_query
},
{
/* This component is checkpointable */
MCA_BASE_METADATA_PARAM_CHECKPOINT
},
};
static orte_filem_base_module_t none_module = {
/** Initialization Function */
orte_filem_base_module_init,
/** Finalization Function */
orte_filem_base_module_finalize,
orte_filem_base_none_put,
orte_filem_base_none_put_nb,
orte_filem_base_none_get,
orte_filem_base_none_get_nb,
orte_filem_base_none_rm,
orte_filem_base_none_rm_nb,
orte_filem_base_none_wait,
orte_filem_base_none_wait_all
};
int orte_filem_base_select(void)
{
int exit_status = OPAL_SUCCESS;
int exit_status = ORTE_SUCCESS;
orte_filem_base_component_t *best_component = NULL;
orte_filem_base_module_t *best_module = NULL;
char *include_list = NULL;
/*
* Register the framework MCA param and look up include list
*/
mca_base_param_reg_string_name("filem", NULL,
"Which FILEM component to use (empty = auto-select)",
false, false,
NULL, &include_list);
/* If we do not have any components to select this is ok. The user likely
* decided not to build with filem components. Just use the none
* component and move on.
*/
if( 0 >= opal_list_get_size(&orte_filem_base_components_available) ||
(NULL != include_list && 0 == strncmp(include_list, "none", strlen("none")) ) ) {
opal_output_verbose(1, orte_filem_base_output,
"filem:select: Warning: Using none component. Some functionality (e.g., --preload-binary) will not work in this mode.");
best_component = &none_component;
best_module = &none_module;
/* JJH: Todo: Check if none is in the list */
/* Close all components since none will be used */
mca_base_components_close(0, /* Pass 0 to keep this from closing the output handle */
&orte_filem_base_components_available,
NULL);
goto skip_select;
}
/*
* Select the best component
@ -109,29 +47,22 @@ int orte_filem_base_select(void)
&orte_filem_base_components_available,
(mca_base_module_t **) &best_module,
(mca_base_component_t **) &best_component) ) {
/* This will only happen if no component was selected */
exit_status = ORTE_ERROR;
goto cleanup;
/* It is okay to not select anything - we'll just retain
* the default none module
*/
return ORTE_SUCCESS;
}
skip_select:
/* Save the winner */
orte_filem_base_selected_component = *best_component;
orte_filem = *best_module;
/* Initialize the winner */
if (NULL != best_module) {
if (OPAL_SUCCESS != orte_filem.filem_init()) {
exit_status = OPAL_ERROR;
goto cleanup;
if (NULL != orte_filem.filem_init) {
if (ORTE_SUCCESS != orte_filem.filem_init()) {
exit_status = ORTE_ERROR;
}
}
cleanup:
if( NULL != include_list ) {
free(include_list);
include_list = NULL;
}
return exit_status;
}