Skip to content

Commit d57a944

Browse files
committed
Restore mca_btl_self_send() to return 1
- Remove self from alternate btls. - Force osc/rdma to take the non btl-atomic path for self. Signed-off-by: Austen Lauria <[email protected]>
1 parent 691037a commit d57a944

File tree

5 files changed

+26
-18
lines changed

5 files changed

+26
-18
lines changed

ompi/mca/osc/rdma/osc_rdma_component.c

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ static int ompi_osc_rdma_component_register (void)
266266
MCA_BASE_VAR_SCOPE_GROUP, &ompi_osc_rdma_btl_names);
267267
free(description_str);
268268

269-
ompi_osc_rdma_btl_alternate_names = "sm,self,tcp";
269+
ompi_osc_rdma_btl_alternate_names = "sm,tcp";
270270
opal_asprintf(&description_str, "Comma-delimited list of alternate BTL component names to allow without verifying "
271271
"connectivity (default: %s)", ompi_osc_rdma_btl_alternate_names);
272272
(void) mca_base_component_var_register (&mca_osc_rdma_component.super.osc_version, "alternate_btls", description_str,
@@ -521,7 +521,7 @@ static int allocate_state_single (ompi_osc_rdma_module_t *module, void **base, s
521521
my_peer->flags |= OMPI_OSC_RDMA_PEER_LOCAL_BASE;
522522
my_peer->state = (uint64_t) (uintptr_t) module->state;
523523

524-
if (module->use_cpu_atomics) {
524+
if (module->use_cpu_atomics || my_peer->rank == my_rank) {
525525
/* all peers are local or it is safe to mix cpu and nic atomics */
526526
my_peer->flags |= OMPI_OSC_RDMA_PEER_LOCAL_STATE;
527527
} else {
@@ -596,7 +596,7 @@ static int allocate_state_shared (ompi_osc_rdma_module_t *module, void **base, s
596596

597597
if (!module->single_node) {
598598
for (int i = 0 ; i < module->btls_in_use ; ++i) {
599-
module->use_cpu_atomics = module->use_cpu_atomics && !!(module->selected_btls[i]->btl_flags & MCA_BTL_ATOMIC_SUPPORTS_GLOB);
599+
module->use_cpu_atomics = module->use_cpu_atomics && !!(module->selected_btls[i]->btl_atomic_flags & MCA_BTL_ATOMIC_SUPPORTS_GLOB);
600600
}
601601
}
602602

@@ -776,7 +776,7 @@ static int allocate_state_shared (ompi_osc_rdma_module_t *module, void **base, s
776776
ex_peer = (ompi_osc_rdma_peer_extended_t *) peer;
777777

778778
/* set up peer state */
779-
if (module->use_cpu_atomics) {
779+
if (module->use_cpu_atomics || peer->rank == my_rank) {
780780
/* all peers are local or it is safe to mix cpu and nic atomics */
781781
peer->flags |= OMPI_OSC_RDMA_PEER_LOCAL_STATE;
782782
peer->state = (osc_rdma_counter_t) peer_state;
@@ -805,7 +805,7 @@ static int allocate_state_shared (ompi_osc_rdma_module_t *module, void **base, s
805805
ompi_osc_module_add_peer (module, peer);
806806

807807
if (MPI_WIN_FLAVOR_DYNAMIC == module->flavor) {
808-
if (module->use_cpu_atomics && peer_rank == my_rank) {
808+
if (peer_rank == my_rank) {
809809
peer->flags |= OMPI_OSC_RDMA_PEER_LOCAL_BASE;
810810
}
811811
/* nothing more to do */
@@ -821,15 +821,14 @@ static int allocate_state_shared (ompi_osc_rdma_module_t *module, void **base, s
821821
ex_peer->size = temp[i].size;
822822
}
823823

824-
if (module->use_cpu_atomics && (MPI_WIN_FLAVOR_ALLOCATE == module->flavor || peer_rank == my_rank)) {
824+
if (module->use_cpu_atomics && (MPI_WIN_FLAVOR_ALLOCATE == module->flavor)) {
825825
/* base is local and cpu atomics are available */
826826
if (MPI_WIN_FLAVOR_ALLOCATE == module->flavor) {
827827
ex_peer->super.base = (uintptr_t) module->segment_base + offset;
828828
} else {
829829
ex_peer->super.base = (uintptr_t) *base;
830830
}
831831

832-
peer->flags |= OMPI_OSC_RDMA_PEER_LOCAL_BASE;
833832
offset += temp[i].size;
834833
} else {
835834
ex_peer->super.base = peer_region->base;
@@ -838,6 +837,10 @@ static int allocate_state_shared (ompi_osc_rdma_module_t *module, void **base, s
838837
ex_peer->super.base_handle = (mca_btl_base_registration_handle_t *) peer_region->btl_handle_data;
839838
}
840839
}
840+
841+
if(my_rank == peer_rank) {
842+
peer->flags |= OMPI_OSC_RDMA_PEER_LOCAL_BASE;
843+
}
841844
}
842845
} while (0);
843846

ompi/mca/osc/rdma/osc_rdma_lock.h

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,12 @@ static inline int ompi_osc_rdma_btl_fop (ompi_osc_rdma_module_t *module, uint8_t
8686

8787
if (OPAL_SUCCESS != ret) {
8888
if (OPAL_LIKELY(1 == ret)) {
89-
*result = ((int64_t *) pending_op->op_buffer)[0];
9089
ret = OMPI_SUCCESS;
91-
ompi_osc_rdma_atomic_complete (selected_btl, endpoint, pending_op->op_buffer,
92-
pending_op->op_frag->handle, (void *) pending_op, NULL, OPAL_SUCCESS);
90+
if(false == pending_op->op_complete) {
91+
*result = ((int64_t *) pending_op->op_buffer)[0];
92+
ompi_osc_rdma_atomic_complete (selected_btl, endpoint, pending_op->op_buffer,
93+
pending_op->op_frag->handle, (void *) pending_op, NULL, OPAL_SUCCESS);
94+
}
9395
} else {
9496
/* need to release here because ompi_osc_rdma_atomic_complete was not called */
9597
OBJ_RELEASE(pending_op);
@@ -161,8 +163,10 @@ static inline int ompi_osc_rdma_btl_op (ompi_osc_rdma_module_t *module, uint8_t
161163
/* need to release here because ompi_osc_rdma_atomic_complete was not called */
162164
OBJ_RELEASE(pending_op);
163165
if (OPAL_LIKELY(1 == ret)) {
164-
if (cbfunc) {
165-
cbfunc (cbdata, cbcontext, OMPI_SUCCESS);
166+
if(false == pending_op->op_complete) {
167+
if (cbfunc) {
168+
cbfunc (cbdata, cbcontext, OMPI_SUCCESS);
169+
}
166170
}
167171
ret = OMPI_SUCCESS;
168172
}

ompi/mca/osc/rdma/osc_rdma_peer.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ static int ompi_osc_rdma_peer_btl_endpoint (struct ompi_osc_rdma_module_t *modul
7171
}
7272
}
7373

74+
OSC_RDMA_VERBOSE(MCA_BASE_VERBOSE_DEBUG, "WARNING - couldn't find a connection");
7475
/* unlikely but can happen when creating a peer for self */
7576
return OMPI_ERR_UNREACH;
7677
}

opal/mca/btl/base/btl_base_am_rdma.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -614,7 +614,7 @@ static int mca_btl_base_am_rdma_respond(mca_btl_base_module_t *btl,
614614
send_descriptor->des_cbfunc = NULL;
615615

616616
int ret = btl->btl_send(btl, endpoint, send_descriptor, mca_btl_base_rdma_resp_tag());
617-
if (OPAL_UNLIKELY(OPAL_SUCCESS != ret)) {
617+
if (OPAL_UNLIKELY(ret < 0)) {
618618
*descriptor = send_descriptor;
619619
}
620620
return ret;
@@ -635,7 +635,7 @@ mca_btl_base_am_rmda_rdma_complete(mca_btl_base_module_t *btl,
635635
operation->is_completed = true;
636636
int ret = mca_btl_base_am_rdma_respond(operation->btl, operation->endpoint,
637637
&operation->descriptor, NULL, &operation->hdr);
638-
if (OPAL_UNLIKELY(OPAL_SUCCESS != ret)) {
638+
if (OPAL_UNLIKELY(ret < 0)) {
639639
BTL_VERBOSE(
640640
("could not send a response. queueing the response for later. endpoint=%p, ret=%d",
641641
endpoint, ret));
@@ -781,7 +781,7 @@ static int mca_btl_base_am_rdma_progress(void)
781781
int ret = descriptor->btl->btl_send(descriptor->btl, descriptor->endpoint,
782782
descriptor->descriptor,
783783
mca_btl_base_rdma_tag(context->type));
784-
if (OPAL_SUCCESS == ret) {
784+
if (ret <= 1) {
785785
opal_list_remove_item(&default_module.queued_initiator_descriptors,
786786
&descriptor->super);
787787
}
@@ -932,7 +932,7 @@ static void mca_btl_base_am_process_rdma(mca_btl_base_module_t *btl,
932932
abort();
933933
}
934934

935-
if (OPAL_SUCCESS != ret) {
935+
if (ret < 0) {
936936
mca_btl_base_rdma_queue_operation(btl, desc->endpoint, descriptor, 0, hdr, operation);
937937
}
938938
}
@@ -995,7 +995,7 @@ static void mca_btl_base_am_process_atomic(mca_btl_base_module_t *btl,
995995

996996
mca_btl_base_descriptor_t *descriptor = NULL;
997997
int ret = mca_btl_base_am_rdma_respond(btl, desc->endpoint, &descriptor, &atomic_response, hdr);
998-
if (OPAL_SUCCESS != ret) {
998+
if (ret < 0) {
999999
mca_btl_base_rdma_queue_operation(btl, desc->endpoint, descriptor, atomic_response, hdr,
10001000
NULL);
10011001
}

opal/mca/btl/self/btl_self.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ static int mca_btl_self_send(struct mca_btl_base_module_t *btl,
218218
if (btl_ownership) {
219219
mca_btl_self_free(btl, des);
220220
}
221-
return OPAL_SUCCESS;
221+
return 1;
222222
}
223223

224224
static int mca_btl_self_sendi(struct mca_btl_base_module_t *btl,

0 commit comments

Comments
 (0)