Skip to content

Commit 8bd3d15

Browse files
committed
test/mpi: Add non-collective sessions init test
Add a test to verify the non-collective behavior of MPI_Session_init. First, run a collective init/finalize sequence over all launched processes. Second, try to re-initialize and finalize a new session from just a single process.
1 parent 5c297d0 commit 8bd3d15

File tree

4 files changed

+34
-1
lines changed

4 files changed

+34
-1
lines changed

test/mpi/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1530,6 +1530,7 @@
15301530
/session/session_psets
15311531
/session/session_self
15321532
/session/session_bsend
1533+
/session/session_non_coll
15331534
/spawn/concurrent_spawns
15341535
/spawn/disconnect
15351536
/spawn/disconnect2

test/mpi/session/Makefile.am

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ noinst_PROGRAMS = \
1616
session_re_init \
1717
session_psets \
1818
session_self \
19-
session_bsend
19+
session_bsend \
20+
session_non_coll
2021

2122
session_mult_init_SOURCES = session.c
2223
session_mult_init_CPPFLAGS = -DMULT_INIT $(AM_CPPFLAGS)
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*
2+
* Copyright (C) by Argonne National Laboratory
3+
* See COPYRIGHT in top-level directory
4+
*/
5+
6+
#include "mpi.h"
7+
#include "stdio.h"
8+
9+
int main(int argc, char *argv[])
10+
{
11+
int ret;
12+
MPI_Session session;
13+
MPI_Group group;
14+
int rank;
15+
16+
MPI_Session_init(MPI_INFO_NULL, MPI_ERRORS_ABORT, &session);
17+
MPI_Group_from_session_pset(session, "mpi://world", &group);
18+
MPI_Group_rank(group, &rank);
19+
MPI_Group_free(&group);
20+
MPI_Session_finalize(&session);
21+
22+
/* second init from a single process to verify non-collective behavior */
23+
if (rank == 0) {
24+
MPI_Session_init(MPI_INFO_NULL, MPI_ERRORS_RETURN, &session);
25+
MPI_Session_finalize(&session);
26+
printf("No Errors\n");
27+
}
28+
29+
return 0;
30+
}

test/mpi/session/testlist

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ session_re_init 4
55
session_psets 1
66
session_self 1
77
session_bsend 2
8+
session_non_coll 4

0 commit comments

Comments
 (0)