Blame test/mpi/topo/topotest.c

Packit Service c5cf8c
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
Packit Service c5cf8c
/*
Packit Service c5cf8c
 *
Packit Service c5cf8c
 *  (C) 2003 by Argonne National Laboratory.
Packit Service c5cf8c
 *      See COPYRIGHT in top-level directory.
Packit Service c5cf8c
 */
Packit Service c5cf8c
#include "mpi.h"
Packit Service c5cf8c
#include <stdio.h>
Packit Service c5cf8c
#include "mpitest.h"
Packit Service c5cf8c
Packit Service c5cf8c
int main(int argc, char *argv[])
Packit Service c5cf8c
{
Packit Service c5cf8c
    int errs = 0;
Packit Service c5cf8c
    int topo_type, size, dims[1], periods[1];
Packit Service c5cf8c
    MPI_Comm comm;
Packit Service c5cf8c
Packit Service c5cf8c
    MTest_Init(&argc, &argv);
Packit Service c5cf8c
Packit Service c5cf8c
    /* Check that topo test returns the correct type, including
Packit Service c5cf8c
     * MPI_UNDEFINED */
Packit Service c5cf8c
Packit Service c5cf8c
    MPI_Topo_test(MPI_COMM_WORLD, &topo_type);
Packit Service c5cf8c
    if (topo_type != MPI_UNDEFINED) {
Packit Service c5cf8c
        errs++;
Packit Service c5cf8c
        printf("Topo type of comm world is not UNDEFINED\n");
Packit Service c5cf8c
    }
Packit Service c5cf8c
Packit Service c5cf8c
    MPI_Comm_size(MPI_COMM_WORLD, &size);
Packit Service c5cf8c
    dims[0] = size;
Packit Service c5cf8c
    periods[0] = 0;
Packit Service c5cf8c
    MPI_Cart_create(MPI_COMM_WORLD, 1, dims, periods, 0, &comm);
Packit Service c5cf8c
    MPI_Topo_test(comm, &topo_type);
Packit Service c5cf8c
    if (topo_type != MPI_CART) {
Packit Service c5cf8c
        errs++;
Packit Service c5cf8c
        printf("Topo type of cart comm is not CART\n");
Packit Service c5cf8c
    }
Packit Service c5cf8c
Packit Service c5cf8c
    MPI_Comm_free(&comm);
Packit Service c5cf8c
    /* FIXME: still need graph example */
Packit Service c5cf8c
Packit Service c5cf8c
    MTest_Finalize(errs);
Packit Service c5cf8c
    return MTestReturnValue(errs);
Packit Service c5cf8c
}