Skip to content
This repository was archived by the owner on Sep 30, 2022. It is now read-only.

Commit 8f1838d

Browse files
committed
Merge pull request #1459 from alinask/topic/openib_diff_subnets
btl/openib: enable connecting processes from different subnets.
2 parents 9b83e66 + bbcbe3c commit 8f1838d

File tree

4 files changed

+32
-1
lines changed

4 files changed

+32
-1
lines changed

opal/mca/btl/openib/btl_openib.c

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -849,6 +849,14 @@ static int init_ib_proc_nolock(mca_btl_openib_module_t* openib_btl, mca_btl_open
849849
matching_port = j;
850850
}
851851
rem_port_cnt++;
852+
} else {
853+
if (mca_btl_openib_component.allow_different_subnets) {
854+
BTL_VERBOSE(("Using different subnets!"));
855+
if (rem_port_cnt == btl_rank) {
856+
matching_port = j;
857+
}
858+
rem_port_cnt++;
859+
}
852860
}
853861
}
854862

@@ -915,6 +923,13 @@ static int init_ib_proc_nolock(mca_btl_openib_module_t* openib_btl, mca_btl_open
915923
break;
916924
else
917925
rem_port_cnt ++;
926+
} else {
927+
if (mca_btl_openib_component.allow_different_subnets) {
928+
if (rem_port_cnt == btl_rank)
929+
break;
930+
else
931+
rem_port_cnt ++;
932+
}
918933
}
919934
}
920935

@@ -981,6 +996,13 @@ static int get_openib_btl_params(mca_btl_openib_module_t* openib_btl, int *port_
981996
rank = port_cnt;
982997
}
983998
port_cnt++;
999+
} else {
1000+
if (mca_btl_openib_component.allow_different_subnets) {
1001+
if (openib_btl == mca_btl_openib_component.openib_btls[j]) {
1002+
rank = port_cnt;
1003+
}
1004+
port_cnt++;
1005+
}
9841006
}
9851007
}
9861008
*port_cnt_ptr = port_cnt;

opal/mca/btl/openib/btl_openib.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,9 @@ struct mca_btl_openib_component_t {
295295
char* default_recv_qps;
296296
/** GID index to use */
297297
int gid_index;
298+
/* Whether we want to allow connecting processes from different subnets.
299+
* set to 'no' by default */
300+
bool allow_different_subnets;
298301
/** Whether we want a dynamically resizing srq, enabled by default */
299302
bool enable_srq_resize;
300303
bool allow_max_memory_registration;

opal/mca/btl/openib/btl_openib_mca.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -706,6 +706,11 @@ int btl_openib_register_mca_params(void)
706706
0, &mca_btl_openib_component.gid_index,
707707
REGINT_GE_ZERO));
708708

709+
CHECK(reg_bool("allow_different_subnets", NULL,
710+
"Allow connecting processes from different IB subnets."
711+
"(0 = do not allow; 1 = allow)",
712+
false, &mca_btl_openib_component.allow_different_subnets));
713+
709714
#if MEMORY_LINUX_MALLOC_ALIGN_ENABLED
710715
tmp = mca_base_var_find ("opal", "memory", "linux", "memalign");
711716
if (0 <= tmp) {

opal/mca/btl/openib/connect/btl_openib_connect_rdmacm.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2109,7 +2109,8 @@ static int rdmacm_component_query(mca_btl_openib_module_t *openib_btl, opal_btl_
21092109
sin.sin_addr.s_addr = rdmacm_addr;
21102110
sin.sin_port = (uint16_t) rdmacm_port;
21112111
#else
2112-
rc = ibv_query_gid(openib_btl->device->ib_pd->context, openib_btl->port_num, 0, &server->gid);
2112+
rc = ibv_query_gid(openib_btl->device->ib_pd->context, openib_btl->port_num,
2113+
mca_btl_openib_component.gid_index, &server->gid);
21132114
if (0 != rc) {
21142115
BTL_ERROR(("local gid query failed"));
21152116
goto out4;

0 commit comments

Comments
 (0)