Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
This particular RMA test is filled with stupid calls... We send errors for most of...
[simgrid.git] / teshsuite / smpi / mpich3-test / group / glpid.c
1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
2 /*
3  *
4  *  (C) 2001 by Argonne National Laboratory.
5  *      See COPYRIGHT in top-level directory.
6  */
7 #include <stdio.h>
8 #include "mpi.h"
9 #include "mpiimpl.h"
10
11 int main(int argc, char *argv[])
12 {
13     MPIR_Group group, *group_ptr = &group;
14     int i;
15
16     MPI_Init(&argc, &argv);
17
18     /* Setup a sample group */
19     group.handle = 1;
20     group.ref_count = 1;
21     group.size = 4;
22     group.rank = 0;
23     group.idx_of_first_lpid = -1;
24     group.lrank_to_lpid = (MPII_Group_pmap_t *)
25         MPL_malloc(group.size * sizeof(MPII_Group_pmap_t));
26     for (i = 0; i < group.size; i++) {
27         group.lrank_to_lpid[i].lrank = i;
28         group.lrank_to_lpid[i].lpid = group.size - i - 1;
29         group.lrank_to_lpid[i].next_lpid = -1;
30         group.lrank_to_lpid[i].flag = 0;
31     }
32
33     /* Set up the group lpid list */
34     MPII_Group_setup_lpid_list(group_ptr);
35
36     /* Print the group structure */
37     printf("Index of first lpid = %d\n", group.idx_of_first_lpid);
38     for (i = 0; i < group.size; i++) {
39         printf("lrank_to_lpid[%d].next_lpid = %d, .lpid = %d\n",
40                i, group.lrank_to_lpid[i].next_lpid, group.lrank_to_lpid[i].lpid);
41     }
42
43     MPI_Finalize();
44     return 0;
45 }