Skip to content

Commit 271deed

Browse files
committed
Fix the vprotocol initialization.
Add a comment about the stages in the vprotocols initialization and why we cant use the threading provided during the PML initialization. Instead, use the OMPI internal threading status to prevent the use of message logging in multi-threaded applications. Signed-off-by: George Bosilca <bosilca@icl.utk.edu>
1 parent 684b91a commit 271deed

File tree

2 files changed

+24
-18
lines changed

2 files changed

+24
-18
lines changed

ompi/mca/pml/v/pml_v_component.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include "ompi/mca/vprotocol/base/base.h"
2929
#include "pml_v_output.h"
3030
#include "pml_v.h"
31+
#include "ompi/runtime/mpiruntime.h"
3132

3233
static int mca_pml_v_component_register(void);
3334
static int mca_pml_v_component_open(void);
@@ -61,9 +62,6 @@ mca_pml_base_component_2_0_0_t mca_pml_v_component =
6162
.pmlm_finalize = mca_pml_v_component_finalize,
6263
};
6364

64-
static bool pml_v_enable_progress_treads = OPAL_ENABLE_PROGRESS_THREADS;
65-
static bool pml_v_enable_mpi_thread_multiple = 1;
66-
6765
static char *ompi_pml_vprotocol_include_list;
6866
static char *ompi_pml_v_output;
6967
static int ompi_pml_v_verbose;
@@ -205,17 +203,19 @@ static int mca_pml_v_component_parasite_close(void)
205203

206204

207205
/*******************************************************************************
208-
* Init/finalize for MCA PML components
206+
* The init function for the V PML is never supposed to be called, as the mechanism
207+
* that enables the PML V to work require a real PML to move data across. Thus, a
208+
* normal PML should be selected (so the PML V cannot be in the MCA list of PMLs)
209+
* and if the PML V is enabled (via the activation of a vprotocol) it will insert
210+
* itself before the selected PML (assuming no DIRECT_call PML).
209211
*/
210-
static mca_pml_base_module_t *mca_pml_v_component_init(int *priority,
211-
bool enable_progress_threads,
212-
bool enable_mpi_thread_multiple)
212+
static mca_pml_base_module_t*
213+
mca_pml_v_component_init(int *priority,
214+
bool enable_progress_threads,
215+
bool enable_mpi_thread_multiple)
213216
{
214217
V_OUTPUT_VERBOSE(1, "init: I'm not supposed to be here until BTL loading stuff gets fixed!? That's strange...");
215218

216-
pml_v_enable_progress_treads = enable_progress_threads;
217-
pml_v_enable_mpi_thread_multiple = enable_mpi_thread_multiple;
218-
219219
/* I NEVER want to be the selected PML, so I report less than possible
220220
* priority and a NULL module
221221
*/
@@ -249,8 +249,8 @@ static int mca_pml_v_enable(bool enable)
249249
if(enable) {
250250
/* Check if a protocol have been selected during init */
251251
if(! mca_vprotocol_base_selected())
252-
mca_vprotocol_base_select(pml_v_enable_progress_treads,
253-
pml_v_enable_mpi_thread_multiple);
252+
mca_vprotocol_base_select(OPAL_ENABLE_PROGRESS_THREADS,
253+
ompi_mpi_thread_multiple);
254254

255255
/* Check if we succeeded selecting a protocol */
256256
if(mca_vprotocol_base_selected()) {

ompi/mca/vprotocol/pessimist/vprotocol_pessimist_component.c

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ static int mca_vprotocol_pessimist_component_register(void)
100100
static int mca_vprotocol_pessimist_component_open(void)
101101
{
102102
V_OUTPUT_VERBOSE(500, "vprotocol_pessimist: component_open: read priority %d", _priority);
103-
return OMPI_SUCCESS;
103+
return OMPI_SUCCESS;
104104
}
105105

106106
static int mca_vprotocol_pessimist_component_close(void)
@@ -111,16 +111,22 @@ static int mca_vprotocol_pessimist_component_close(void)
111111

112112
/** VPROTOCOL level functions (same as PML one)
113113
*/
114-
static mca_vprotocol_base_module_t *mca_vprotocol_pessimist_component_init( int* priority,
115-
bool enable_progress_threads,
116-
bool enable_mpi_threads)
114+
static mca_vprotocol_base_module_t*
115+
mca_vprotocol_pessimist_component_init( int* priority,
116+
bool enable_progress_threads,
117+
bool enable_mpi_threads)
117118
{
118119
V_OUTPUT_VERBOSE(500, "vprotocol_pessimist: component_init");
119120
*priority = _priority;
120121

121122
/* sanity check */
122-
if(enable_mpi_threads)
123-
{
123+
if(enable_mpi_threads) {
124+
/**
125+
* Prevent the pessimistic protocol from activating if we are in a potentially multithreaded
126+
* applications. The reason is that without tracking the thread initiator of messages it is
127+
* extrmely difficult to provide a global message ordering in threaded-scenarios. Thus, the
128+
* safe approach is to turn off the logger.
129+
*/
124130
opal_output(0, "vprotocol_pessimist: component_init: threads are enabled, and not supported by vprotocol pessimist fault tolerant layer, will not load");
125131
return NULL;
126132
}

0 commit comments

Comments
 (0)