Skip to content

Commit ca61c6b

Browse files
committed
reorganize init code so Warning works better
ARMCII_Warning was called before ARMCI_GROUP_WORLD was initialized, so warnings in init were printed by every rank. Signed-off-by: Jeff Hammond <[email protected]>
1 parent 40aa5f0 commit ca61c6b

File tree

2 files changed

+35
-38
lines changed

2 files changed

+35
-38
lines changed

src/groups.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,10 @@
1111
#include <debug.h>
1212

1313

14-
/** The ARMCI world group. This is accessed from outside via
15-
* ARMCI_Group_get_world.
16-
*/
14+
/** The ARMCI world group. This is accessed from outside via ARMCI_Group_get_world. */
1715
ARMCI_Group ARMCI_GROUP_WORLD = {0};
1816
ARMCI_Group ARMCI_GROUP_DEFAULT = {0};
1917

20-
2118
/** Initialize an ARMCI group's remaining fields using the communicator field.
2219
*/
2320
void ARMCII_Group_init_from_comm(ARMCI_Group *group) {

src/init_finalize.c

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,22 @@ int PARMCI_Init_thread_comm(int armci_requested, MPI_Comm comm) {
199199
}
200200
}
201201

202+
/* Setup groups and communicators - do this before ARMCII_Warning is called! */
203+
204+
MPI_Comm_dup(comm, &ARMCI_GROUP_WORLD.comm);
205+
ARMCII_Group_init_from_comm(&ARMCI_GROUP_WORLD);
206+
ARMCI_GROUP_DEFAULT = ARMCI_GROUP_WORLD;
207+
208+
/* Create GOP operators */
209+
210+
MPI_Op_create(ARMCII_Absmin_op, 1 /* commute */, &ARMCI_MPI_ABSMIN_OP);
211+
MPI_Op_create(ARMCII_Absmax_op, 1 /* commute */, &ARMCI_MPI_ABSMAX_OP);
212+
213+
MPI_Op_create(ARMCII_Msg_sel_min_op, 1 /* commute */, &ARMCI_MPI_SELMIN_OP);
214+
MPI_Op_create(ARMCII_Msg_sel_max_op, 1 /* commute */, &ARMCI_MPI_SELMAX_OP);
215+
216+
/* Determine environmental settings */
217+
202218
ARMCII_GLOBAL_STATE.verbose = ARMCII_Getenv_int("ARMCI_VERBOSE", 0);
203219

204220
/* Figure out what MPI library we are using, in an attempt to work around bugs. */
@@ -277,7 +293,18 @@ int PARMCI_Init_thread_comm(int armci_requested, MPI_Comm comm) {
277293
}
278294
ARMCII_GLOBAL_STATE.cache_rank_translation = ARMCII_Getenv_bool("ARMCI_CACHE_RANK_TRANSLATION", 1);
279295

280-
/* Check for IOV flags */
296+
/* Check for IOV and Strided flags */
297+
298+
#if defined(OPEN_MPI) && defined(OMPI_MAJOR_VERSION) && (OMPI_MAJOR_VERSION < 5)
299+
/* Open-MPI 5 RMA works a lot better than older releases... */
300+
ARMCII_GLOBAL_STATE.iov_method = ARMCII_IOV_BATCHED;
301+
ARMCII_GLOBAL_STATE.strided_method = ARMCII_STRIDED_IOV;
302+
#else
303+
/* IOV_DIRECT leads to addr=NULL errors when ARMCI_{GetV,PutV} are used
304+
* Jeff: Is this still true? */
305+
ARMCII_GLOBAL_STATE.iov_method = ARMCII_IOV_DIRECT;
306+
ARMCII_GLOBAL_STATE.strided_method = ARMCII_STRIDED_DIRECT;
307+
#endif
281308

282309
#ifdef NO_SEATBELTS
283310
ARMCII_GLOBAL_STATE.iov_checks = 0;
@@ -286,19 +313,11 @@ int PARMCI_Init_thread_comm(int armci_requested, MPI_Comm comm) {
286313
ARMCII_GLOBAL_STATE.iov_batched_limit = ARMCII_Getenv_int("ARMCI_IOV_BATCHED_LIMIT", 0);
287314

288315
if (ARMCII_GLOBAL_STATE.iov_batched_limit < 0) {
289-
ARMCII_Warning("Ignoring invalid value for ARMCI_IOV_BATCHED_LIMIT (%d)\n", ARMCII_GLOBAL_STATE.iov_batched_limit);
316+
ARMCII_Warning("Ignoring invalid value for ARMCI_IOV_BATCHED_LIMIT (%d)\n",
317+
ARMCII_GLOBAL_STATE.iov_batched_limit);
290318
ARMCII_GLOBAL_STATE.iov_batched_limit = 0;
291319
}
292320

293-
#if defined(OPEN_MPI) && defined(OMPI_MAJOR_VERSION) && (OMPI_MAJOR_VERSION < 5)
294-
/* Open-MPI 5 RMA works a lot better than older releases... */
295-
ARMCII_GLOBAL_STATE.iov_method = ARMCII_IOV_BATCHED;
296-
#else
297-
/* DIRECT leads to addr=NULL errors when ARMCI_{GetV,PutV} are used
298-
* Jeff: Is this still true? */
299-
ARMCII_GLOBAL_STATE.iov_method = ARMCII_IOV_DIRECT;
300-
#endif
301-
302321
char *var = ARMCII_Getenv("ARMCI_IOV_METHOD");
303322
if (var != NULL) {
304323
if (strcmp(var, "AUTO") == 0)
@@ -313,14 +332,6 @@ int PARMCI_Init_thread_comm(int armci_requested, MPI_Comm comm) {
313332
ARMCII_Warning("Ignoring unknown value for ARMCI_IOV_METHOD (%s)\n", var);
314333
}
315334

316-
/* Check for Strided flags */
317-
318-
#if defined(OPEN_MPI)
319-
ARMCII_GLOBAL_STATE.strided_method = ARMCII_STRIDED_IOV;
320-
#else
321-
ARMCII_GLOBAL_STATE.strided_method = ARMCII_STRIDED_DIRECT;
322-
#endif
323-
324335
var = ARMCII_Getenv("ARMCI_STRIDED_METHOD");
325336
if (var != NULL) {
326337
if (strcmp(var, "IOV") == 0) {
@@ -334,10 +345,13 @@ int PARMCI_Init_thread_comm(int armci_requested, MPI_Comm comm) {
334345

335346
#ifdef OPEN_MPI
336347
if (ARMCII_GLOBAL_STATE.iov_method == ARMCII_IOV_DIRECT || ARMCII_GLOBAL_STATE.strided_method == ARMCII_STRIDED_DIRECT) {
348+
if (ARMCI_GROUP_WORLD.rank == 0) {
337349
ARMCII_Warning("MPI Datatypes are broken in RMA in many versions of Open-MPI!\n");
338350
#if defined(OMPI_MAJOR_VERSION) && (OMPI_MAJOR_VERSION == 4)
339-
ARMCII_Warning("Open-MPI 4.0.0 RMA with datatypes is definitely broken. See https://github.com/open-mpi/ompi/issues/6275 for details.\n");
351+
ARMCII_Warning("Open-MPI 4.0.0 RMA with datatypes is definitely broken."
352+
"See https://github.com/open-mpi/ompi/issues/6275 for details.\n");
340353
#endif
354+
}
341355
}
342356
#endif
343357

@@ -406,20 +420,6 @@ int PARMCI_Init_thread_comm(int armci_requested, MPI_Comm comm) {
406420
const int use_rma_requests = 0;
407421
#endif
408422

409-
/* Setup groups and communicators */
410-
411-
MPI_Comm_dup(comm, &ARMCI_GROUP_WORLD.comm);
412-
ARMCII_Group_init_from_comm(&ARMCI_GROUP_WORLD);
413-
ARMCI_GROUP_DEFAULT = ARMCI_GROUP_WORLD;
414-
415-
/* Create GOP operators */
416-
417-
MPI_Op_create(ARMCII_Absmin_op, 1 /* commute */, &ARMCI_MPI_ABSMIN_OP);
418-
MPI_Op_create(ARMCII_Absmax_op, 1 /* commute */, &ARMCI_MPI_ABSMAX_OP);
419-
420-
MPI_Op_create(ARMCII_Msg_sel_min_op, 1 /* commute */, &ARMCI_MPI_SELMIN_OP);
421-
MPI_Op_create(ARMCII_Msg_sel_max_op, 1 /* commute */, &ARMCI_MPI_SELMAX_OP);
422-
423423
#ifdef HAVE_MEMKIND_H
424424
char * pool_path;
425425
if (ARMCII_GLOBAL_STATE.use_win_allocate == ARMCII_MEMKIND_WINDOW_TYPE) {

0 commit comments

Comments
 (0)