Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Update topo
[simgrid.git] / teshsuite / smpi / mpich3-test / topo / graphmap1.c
1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
2 /*
3  *
4  *  (C) 2003 by Argonne National Laboratory.
5  *      See COPYRIGHT in top-level directory.
6  */
7 #include "mpi.h"
8 #include <stdio.h>
9 #include "mpitest.h"
10
11 int main(int argc, char *argv[])
12 {
13     int errs = 0;
14     int newrank, merr, rank;
15     int index[2], edges[2];
16
17     MTest_Init(&argc, &argv);
18
19     MPI_Comm_rank(MPI_COMM_WORLD, &rank);
20     /* Graph map where there are no nodes for this process */
21     MPI_Comm_set_errhandler(MPI_COMM_WORLD, MPI_ERRORS_RETURN);
22     /* Here is a singleton graph, containing only the root process */
23     index[0] = 0;
24     edges[0] = 0;
25     merr = MPI_Graph_map(MPI_COMM_WORLD, 1, index, edges, &newrank);
26     if (merr) {
27         errs++;
28         printf("Graph map returned an error\n");
29         MTestPrintError(merr);
30     }
31     if (rank != 0 && newrank != MPI_UNDEFINED) {
32         errs++;
33         printf("Graph map with no local nodes did not return MPI_UNDEFINED\n");
34     }
35
36     MTest_Finalize(errs);
37     MPI_Finalize();
38     return 0;
39
40 }