Skip to content

Commit fc77684

Browse files
committed
osc/pt2pt: Possible to unlock too early before all data has arrived
* From Mark - see comment in code
1 parent 63878c2 commit fc77684

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

ompi/mca/osc/pt2pt/osc_pt2pt_passive_target.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,16 @@ static int ompi_osc_pt2pt_unlock_internal (int target, ompi_win_t *win)
419419
/* wait for unlock acks. this signals remote completion of fragments */
420420
ompi_osc_pt2pt_sync_wait_expected (lock);
421421

422+
/* Mark - It is possible for the unlock to finish too early before
423+
* the data is actually present in teh recv buf (for non-contiguous datatypes)
424+
* So make sure to wait for all of the fragments to arrive.
425+
*/
426+
OPAL_THREAD_LOCK(&module->lock);
427+
while (module->outgoing_frag_count < module->outgoing_frag_signal_count) {
428+
opal_condition_wait(&module->cond, &module->lock);
429+
}
430+
OPAL_THREAD_UNLOCK(&module->lock);
431+
422432
OPAL_OUTPUT_VERBOSE((25, ompi_osc_base_framework.framework_output,
423433
"ompi_osc_pt2pt_unlock: unlock of %d complete", target));
424434
} else {

0 commit comments

Comments
 (0)