Skip to content

Commit efeac60

Browse files
committed
Merge pull request open-mpi#947 from hjelmn/v2.x_osc_pt2pt_fixes
v2.x osc/pt2pt fixes
2 parents 1280d53 + 0e8f267 commit efeac60

File tree

10 files changed

+193
-209
lines changed

10 files changed

+193
-209
lines changed

ompi/mca/osc/pt2pt/osc_pt2pt.h

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* University of Stuttgart. All rights reserved.
99
* Copyright (c) 2004-2005 The Regents of the University of California.
1010
* All rights reserved.
11-
* Copyright (c) 2007-2015 Los Alamos National Security, LLC. All rights
11+
* Copyright (c) 2007-2016 Los Alamos National Security, LLC. All rights
1212
* reserved.
1313
* Copyright (c) 2010 Cisco Systems, Inc. All rights reserved.
1414
* Copyright (c) 2012-2013 Sandia National Laboratories. All rights reserved.
@@ -149,19 +149,20 @@ struct ompi_osc_pt2pt_module_t {
149149
uint32_t *epoch_outgoing_frag_count;
150150

151151
/** cyclic counter for a unique tage for long messages. */
152-
unsigned int tag_counter;
152+
uint32_t tag_counter;
153+
uint32_t rtag_counter;
153154

154155
/* Number of outgoing fragments that have completed since the
155156
begining of time */
156-
uint32_t outgoing_frag_count;
157+
volatile uint32_t outgoing_frag_count;
157158
/* Next outgoing fragment count at which we want a signal on cond */
158-
uint32_t outgoing_frag_signal_count;
159+
volatile uint32_t outgoing_frag_signal_count;
159160

160161
/* Number of incoming fragments that have completed since the
161162
begining of time */
162-
uint32_t active_incoming_frag_count;
163+
volatile uint32_t active_incoming_frag_count;
163164
/* Next incoming buffer count at which we want a signal on cond */
164-
uint32_t active_incoming_frag_signal_count;
165+
volatile uint32_t active_incoming_frag_signal_count;
165166

166167
/** Number of targets locked/being locked */
167168
unsigned int passive_target_access_epoch;
@@ -408,14 +409,6 @@ int ompi_osc_pt2pt_component_irecv(ompi_osc_pt2pt_module_t *module,
408409
int tag,
409410
struct ompi_communicator_t *comm);
410411

411-
int ompi_osc_pt2pt_component_isend(ompi_osc_pt2pt_module_t *module,
412-
const void *buf,
413-
size_t count,
414-
struct ompi_datatype_t *datatype,
415-
int dest,
416-
int tag,
417-
struct ompi_communicator_t *comm);
418-
419412
/**
420413
* ompi_osc_pt2pt_progress_pending_acc:
421414
*
@@ -657,13 +650,18 @@ static inline int get_tag(ompi_osc_pt2pt_module_t *module)
657650
/* the LSB of the tag is used be the receiver to determine if the
658651
message is a passive or active target (ie, where to mark
659652
completion). */
660-
int tmp = module->tag_counter + !!(module->passive_target_access_epoch);
661-
662-
module->tag_counter = (module->tag_counter + 2) & OSC_PT2PT_FRAG_MASK;
663-
664-
return tmp;
653+
int32_t tmp = OPAL_THREAD_ADD32((volatile int32_t *) &module->tag_counter, 4);
654+
return (tmp & OSC_PT2PT_FRAG_MASK) | !!(module->passive_target_access_epoch);
665655
}
666656

657+
static inline int get_rtag(ompi_osc_pt2pt_module_t *module)
658+
{
659+
/* the LSB of the tag is used be the receiver to determine if the
660+
message is a passive or active target (ie, where to mark
661+
completion). */
662+
int32_t tmp = OPAL_THREAD_ADD32((volatile int32_t *) &module->rtag_counter, 4);
663+
return (tmp & OSC_PT2PT_FRAG_MASK) | !!(module->passive_target_access_epoch);
664+
}
667665
/**
668666
* ompi_osc_pt2pt_accumulate_lock:
669667
*

ompi/mca/osc/pt2pt/osc_pt2pt_active_target.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* University of Stuttgart. All rights reserved.
99
* Copyright (c) 2004-2005 The Regents of the University of California.
1010
* All rights reserved.
11-
* Copyright (c) 2007-2015 Los Alamos National Security, LLC. All rights
11+
* Copyright (c) 2007-2016 Los Alamos National Security, LLC. All rights
1212
* reserved.
1313
* Copyright (c) 2010 IBM Corporation. All rights reserved.
1414
* Copyright (c) 2012-2013 Sandia National Laboratories. All rights reserved.
@@ -147,6 +147,7 @@ int ompi_osc_pt2pt_fence(int assert, ompi_win_t *win)
147147

148148
/* short-circuit the noprecede case */
149149
if (0 != (assert & MPI_MODE_NOPRECEDE)) {
150+
module->comm->c_coll.coll_barrier (module->comm, module->comm->c_coll.coll_barrier);
150151
OPAL_OUTPUT_VERBOSE((50, ompi_osc_base_framework.framework_output,
151152
"osc pt2pt: fence end (short circuit)"));
152153
return ret;
@@ -211,7 +212,7 @@ int ompi_osc_pt2pt_start (ompi_group_t *group, int assert, ompi_win_t *win)
211212
ompi_osc_pt2pt_module_t *module = GET_MODULE(win);
212213
ompi_osc_pt2pt_sync_t *sync = &module->all_sync;
213214

214-
OPAL_THREAD_LOCK(&sync->lock);
215+
OPAL_THREAD_LOCK(&module->lock);
215216

216217
/* check if we are already in an access epoch */
217218
if (ompi_osc_pt2pt_access_epoch_active (module)) {

0 commit comments

Comments
 (0)