From ccb3f75e8f70e4a48e6c0407c17e25b99bd2ebdb Mon Sep 17 00:00:00 2001 From: Aurelien Bouteiller Date: Wed, 12 Sep 2007 20:47:17 +0000 Subject: [PATCH] Make sure that the pml v parasite never get loaded when user did not requested FT. This does not break the ability to switch protocol on the fly. This commit was SVN r16114. --- ompi/mca/pml/v/pml_v_component.c | 24 ++++++---- ompi/mca/pml/v/vprotocol/base/base.h | 5 +- .../mca/pml/v/vprotocol/base/vprotocol_base.c | 8 +++- .../v/vprotocol/base/vprotocol_base_select.c | 48 ++++++++++--------- .../pessimist/vprotocol_pessimist_component.c | 4 +- .../pessimist/vprotocol_pessimist_event.h | 2 +- 6 files changed, 54 insertions(+), 37 deletions(-) diff --git a/ompi/mca/pml/v/pml_v_component.c b/ompi/mca/pml/v/pml_v_component.c index 6136033714..7f5bcae851 100644 --- a/ompi/mca/pml/v/pml_v_component.c +++ b/ompi/mca/pml/v/pml_v_component.c @@ -58,8 +58,6 @@ mca_pml_base_component_1_0_0_t mca_pml_v_component = static bool pml_v_enable_progress_treads = OMPI_ENABLE_PROGRESS_THREADS; static bool pml_v_enable_mpi_threads = OMPI_ENABLE_MPI_THREADS; - - /******************************************************************************* * MCA level functions - parasite setup */ @@ -68,30 +66,40 @@ static int mca_pml_v_component_open(void) char *output; int verbose; int priority; + char *vprotocol_include_list; + int ret; priority = mca_pml_v_param_register_int("priority", -1); output = mca_pml_v_param_register_string("output", "stderr"); verbose = mca_pml_v_param_register_int("verbose", 0); + mca_base_param_reg_string_name("vprotocol", NULL, + "Specify a specific vprotocol to use", + false, false, "", &vprotocol_include_list); + pml_v_output_open(output, verbose); if(-1 != priority) V_OUTPUT_ERR("pml_v: Overriding priority setting (%d) with -1. The PML V should NEVER be the selected component; even when enabling fault tolerance.", priority); V_OUTPUT_VERBOSE(500, "loaded"); - return mca_vprotocol_base_open(); + + return mca_vprotocol_base_open(vprotocol_include_list); } static int mca_pml_v_component_close(void) { int ret; - - V_OUTPUT_VERBOSE(500, "component_close: I don't want to be unloaded now."); - + /* Save original PML before making any changes */ mca_pml_v.host_pml_component = mca_pml_base_selected_component; mca_pml_v.host_pml = mca_pml; - + + /* Do not load anything if no FT protocol is selected */ + if(! mca_vprotocol_base_include_list[0]) + return mca_pml_v_component_parasite_close(); + + V_OUTPUT_VERBOSE(500, "component_close: I don't want to be unloaded now."); ret = mca_base_component_repository_retain_component("pml", "v"); if(OPAL_SUCCESS != ret) { @@ -144,7 +152,7 @@ static int mca_pml_v_component_parasite_finalize(void) static int mca_pml_v_component_parasite_close(void) { - V_OUTPUT_VERBOSE(500, "parasite_close: Ok, host component %s is closing, so I accept to die", + V_OUTPUT_VERBOSE(500, "parasite_close: Ok, I accept to die and let %s component finish", mca_pml_v.host_pml_component.pmlm_version.mca_component_name); mca_pml_base_selected_component = mca_pml_v.host_pml_component; diff --git a/ompi/mca/pml/v/vprotocol/base/base.h b/ompi/mca/pml/v/vprotocol/base/base.h index 8653572c78..633dccd914 100644 --- a/ompi/mca/pml/v/vprotocol/base/base.h +++ b/ompi/mca/pml/v/vprotocol/base/base.h @@ -20,12 +20,13 @@ extern "C" { #endif -OMPI_DECLSPEC int mca_vprotocol_base_open(void); +OMPI_DECLSPEC int mca_vprotocol_base_open(char *vprotocol_include_list); OMPI_DECLSPEC int mca_vprotocol_base_select(bool enable_progress_threads, - bool enable_mpi_threads); + bool enable_mpi_threads); OMPI_DECLSPEC int mca_vprotocol_base_parasite(void); OMPI_DECLSPEC int mca_vprotocol_base_close(void); +OMPI_DECLSPEC extern char *mca_vprotocol_base_include_list; OMPI_DECLSPEC extern opal_list_t mca_vprotocol_base_components_available; OMPI_DECLSPEC extern mca_vprotocol_base_component_t mca_vprotocol_component; OMPI_DECLSPEC extern mca_vprotocol_base_module_t mca_vprotocol; diff --git a/ompi/mca/pml/v/vprotocol/base/vprotocol_base.c b/ompi/mca/pml/v/vprotocol/base/vprotocol_base.c index 40f2e6ac55..a9cec5f40a 100644 --- a/ompi/mca/pml/v/vprotocol/base/vprotocol_base.c +++ b/ompi/mca/pml/v/vprotocol/base/vprotocol_base.c @@ -13,13 +13,19 @@ #include "ompi/mca/pml/v/vprotocol/base/static-components.h" opal_list_t mca_vprotocol_base_components_available; +char *mca_vprotocol_base_include_list; /* Load any vprotocol MCA component and call open function of all those * components. + * + * Also fill the mca_vprotocol_base_include_list with components that exists */ -int mca_vprotocol_base_open(void) +int mca_vprotocol_base_open(char *vprotocol_include_list) { + int ret; + OBJ_CONSTRUCT(&mca_vprotocol_base_components_available, opal_list_t); + mca_vprotocol_base_include_list = vprotocol_include_list; return mca_base_components_open("vprotocol", 0, mca_vprotocol_base_static_components, &mca_vprotocol_base_components_available, diff --git a/ompi/mca/pml/v/vprotocol/base/vprotocol_base_select.c b/ompi/mca/pml/v/vprotocol/base/vprotocol_base_select.c index 93d5350423..8f83bee76a 100644 --- a/ompi/mca/pml/v/vprotocol/base/vprotocol_base_select.c +++ b/ompi/mca/pml/v/vprotocol/base/vprotocol_base_select.c @@ -22,6 +22,7 @@ typedef struct opened_component_t { mca_vprotocol_base_component_t *om_component; } opened_component_t; + /* * Function for selecting one component from all those that are * available. @@ -54,37 +55,38 @@ int mca_vprotocol_base_select(bool enable_progress_threads, component = (mca_vprotocol_base_component_t *) cli->cli_component; V_OUTPUT_VERBOSE(500, "vprotocol select: initializing %s component %s", component->pmlm_version.mca_type_name, component->pmlm_version.mca_component_name); - if (NULL == component->pmlm_init) { + if(strcmp(component->pmlm_version.mca_component_name, + mca_vprotocol_base_include_list)) { + V_OUTPUT_VERBOSE(500, "This component is not in the include list: skipping %s", component->pmlm_version.mca_component_name); + continue; + } + if(NULL == component->pmlm_init) { V_OUTPUT_VERBOSE(2, "vprotocol select: no init function; ignoring component %s", component->pmlm_version.mca_component_name); + continue; } - else + module = component->pmlm_init(&priority, enable_progress_threads, enable_mpi_threads); + if (NULL == module) { + V_OUTPUT_VERBOSE(2, "vprotocol select: init returned failure for component %s", component->pmlm_version.mca_component_name); + continue; + } + V_OUTPUT_VERBOSE(500, "vprotocol select: component %s init returned priority %d", component->pmlm_version.mca_component_name, priority); + if (priority > best_priority) { - module = component->pmlm_init(&priority, enable_progress_threads, enable_mpi_threads); - if (NULL == module) { - V_OUTPUT_VERBOSE(2, "vprotocol select: init returned failure for component %s", component->pmlm_version.mca_component_name); - } - else - { - V_OUTPUT_VERBOSE(500, "vprotocol select: component %s init returned priority %d", component->pmlm_version.mca_component_name, priority); - if (priority > best_priority) - { - best_priority = priority; - best_component = component; - best_module = module; - } - - om = malloc(sizeof(opened_component_t)); - if (NULL == om) return OMPI_ERR_OUT_OF_RESOURCE; - OBJ_CONSTRUCT(om, opal_list_item_t); - om->om_component = component; - opal_list_append(&opened, (opal_list_item_t*) om); - } + best_priority = priority; + best_component = component; + best_module = module; } + + om = malloc(sizeof(opened_component_t)); + if (NULL == om) return OMPI_ERR_OUT_OF_RESOURCE; + OBJ_CONSTRUCT(om, opal_list_item_t); + om->om_component = component; + opal_list_append(&opened, (opal_list_item_t*) om); } /* Finished querying all components. Check for the bozo case. */ if (NULL == best_component) { - V_OUTPUT_VERBOSE(2, "vprotocol select: no protocol has returned a positive priority, user don't want fault tolerance"); + V_OUTPUT_VERBOSE(2, "vprotocol select: no protocol has returned a positive priority, fault tolerance is OFF"); } else { diff --git a/ompi/mca/pml/v/vprotocol/pessimist/vprotocol_pessimist_component.c b/ompi/mca/pml/v/vprotocol/pessimist/vprotocol_pessimist_component.c index d7c8feed56..2e8ca88d5e 100644 --- a/ompi/mca/pml/v/vprotocol/pessimist/vprotocol_pessimist_component.c +++ b/ompi/mca/pml/v/vprotocol/pessimist/vprotocol_pessimist_component.c @@ -61,11 +61,11 @@ mca_vprotocol_base_component_1_0_0_t mca_vprotocol_pessimist_component = */ static int mca_vprotocol_pessimist_component_open(void) { - _priority = mca_param_register_int("priority", -1); + _priority = mca_param_register_int("priority", 30); _free_list_num = mca_param_register_int("free_list_num", 16); _free_list_max = mca_param_register_int("free_list_max", -1); _free_list_inc = mca_param_register_int("free_list_inc", 64); - _sender_based_size = mca_param_register_int("sender_based_chunk", 100 * 1024 * 1024); + _sender_based_size = mca_param_register_int("sender_based_chunk", 256 * 1024 * 1024); _event_buffer_size = mca_param_register_int("event_buffer_size", 1024); _mmap_file_name = mca_param_register_string("sender_based_file", "vprotocol_pessimist-senderbased"); V_OUTPUT_VERBOSE(500, "vprotocol_pessimist: component_open: read priority %d", _priority); diff --git a/ompi/mca/pml/v/vprotocol/pessimist/vprotocol_pessimist_event.h b/ompi/mca/pml/v/vprotocol/pessimist/vprotocol_pessimist_event.h index c3bb50ca67..d5c7a80f76 100644 --- a/ompi/mca/pml/v/vprotocol/pessimist/vprotocol_pessimist_event.h +++ b/ompi/mca/pml/v/vprotocol/pessimist/vprotocol_pessimist_event.h @@ -16,7 +16,7 @@ #include "ompi/mca/pml/base/pml_base_request.h" typedef uint64_t vprotocol_pessimist_clock_t; -#define PRIpclock "ullx" +#define PRIpclock "llx" typedef enum { VPROTOCOL_PESSIMIST_EVENT_TYPE_MATCHING,