49 integer :: ref_group_comm, ref_main_comm
50 integer :: main_comm, group_comm
52 integer :: group_comms(2)
53 CHARACTER(len=YAC_MAX_CHARLEN) :: group_names(2)
56 main_comm = mpi_comm_null
57 group_comm = mpi_comm_null
59 select case(global_rank)
62 group_names(1) =
"main"
63 group_names(2) =
"group a"
65 main_comm = group_comms(1)
66 group_comm = group_comms(2)
70 group_names(1) =
"group b"
71 group_names(2) =
"main"
73 group_comm = group_comms(1)
74 main_comm = group_comms(2)
78 group_names(1) =
"main"
80 main_comm = group_comms(1)
86 call mpi_comm_split(mpi_comm_world, color, 0, ref_group_comm, ierror)
87 call mpi_comm_split( &
88 mpi_comm_world,
merge(mpi_undefined, 0, global_rank == 5), 0, &
89 ref_main_comm, ierror)
91 if (ref_group_comm /= mpi_comm_null)
then
93 call mpi_comm_compare(ref_group_comm, group_comm, result, ierror);
95 call test((result == mpi_congruent) .OR. (result == mpi_ident))
97 call mpi_comm_free(ref_group_comm, ierror)
98 call mpi_comm_free(group_comm, ierror)
101 call test(group_comm == mpi_comm_null)
104 if (ref_main_comm /= mpi_comm_null)
then
106 call mpi_comm_compare(ref_main_comm, main_comm, result, ierror);
108 call test((result == mpi_congruent) .OR. (result == mpi_ident))
110 call mpi_comm_free(ref_main_comm, ierror)
111 call mpi_comm_free(main_comm, ierror)
114 call test(main_comm == mpi_comm_null)
static void merge(char *base_a, size_t num_a, int a_ascending, char *base_b, size_t num_b, int b_ascending, size_t size, int(*compar)(const void *, const void *), char *target)