Skip to content

Commit a7ed346

Browse files
committed
hcoll: Fix initialization
Always set is_hcoll_init to 0 at the start of initialization to ensure an uninitialized value is never mistakenly used to invoke hcoll.
1 parent ffe4cbc commit a7ed346

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/mpid/common/hcoll/hcoll_init.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,28 +130,27 @@ int hcoll_comm_create(MPIR_Comm * comm_ptr, void *param)
130130
int context_destroyed;
131131
mpi_errno = MPI_SUCCESS;
132132

133+
comm_ptr->hcoll_priv.is_hcoll_init = 0;
134+
133135
if (0 == hcoll_initialized) {
134136
mpi_errno = hcoll_initialize();
135137
MPIR_ERR_CHECK(mpi_errno);
136138
}
137139

138140
if (0 == hcoll_enable) {
139-
comm_ptr->hcoll_priv.is_hcoll_init = 0;
140141
goto fn_exit;
141142
}
142143

143144
if (MPIR_Process.comm_world == comm_ptr) {
144145
hcoll_comm_world_initialized = 1;
145146
}
146147
if (!hcoll_comm_world_initialized) {
147-
comm_ptr->hcoll_priv.is_hcoll_init = 0;
148148
goto fn_exit;
149149
}
150150
num_ranks = comm_ptr->local_size;
151151
if ((MPIR_COMM_KIND__INTRACOMM != comm_ptr->comm_kind) || (2 > num_ranks)
152152
|| comm_ptr->hierarchy_kind == MPIR_COMM_HIERARCHY_KIND__NODE_ROOTS
153153
|| comm_ptr->hierarchy_kind == MPIR_COMM_HIERARCHY_KIND__NODE) {
154-
comm_ptr->hcoll_priv.is_hcoll_init = 0;
155154
goto fn_exit;
156155
}
157156

0 commit comments

Comments
 (0)