Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add new entry in Release_Notes.
[simgrid.git] / teshsuite / smpi / mpich3-test / topo / topotest.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 topo_type, size, dims[1], periods[1];
15     MPI_Comm comm;
16
17     MTest_Init(&argc, &argv);
18
19     /* Check that topo test returns the correct type, including
20      * MPI_UNDEFINED */
21
22     MPI_Topo_test(MPI_COMM_WORLD, &topo_type);
23     if (topo_type != MPI_UNDEFINED) {
24         errs++;
25         printf("Topo type of comm world is not UNDEFINED\n");
26     }
27
28     MPI_Comm_size(MPI_COMM_WORLD, &size);
29     dims[0] = size;
30     periods[0] = 0;
31     MPI_Cart_create(MPI_COMM_WORLD, 1, dims, periods, 0, &comm);
32     MPI_Topo_test(comm, &topo_type);
33     if (topo_type != MPI_CART) {
34         errs++;
35         printf("Topo type of cart comm is not CART\n");
36     }
37
38     MPI_Comm_free(&comm);
39     /* FIXME: still need graph example */
40
41     MTest_Finalize(errs);
42     MPI_Finalize();
43     return 0;
44
45 }