Blame test/mpi/topo/dims3.c
|
Packit Service |
c5cf8c |
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
|
|
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 |
static inline void print_err(int *dims, int ndims)
|
|
Packit Service |
c5cf8c |
{
|
|
Packit Service |
c5cf8c |
int i;
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
printf("[ ");
|
|
Packit Service |
c5cf8c |
for (i = 0; i < ndims; i++)
|
|
Packit Service |
c5cf8c |
printf("%d ", dims[i]);
|
|
Packit Service |
c5cf8c |
printf("] Suboptimal distribution!\n");
|
|
Packit Service |
c5cf8c |
}
|
|
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 dims[4], ndims, nnodes;
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
MTest_Init(&argc, &argv);
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
for (ndims = 3; ndims <= 4; ndims++) {
|
|
Packit Service |
c5cf8c |
for (nnodes = 2; nnodes <= 4096; nnodes *= 2) {
|
|
Packit Service |
c5cf8c |
int i;
|
|
Packit Service |
c5cf8c |
for (i = 0; i < ndims; i++)
|
|
Packit Service |
c5cf8c |
dims[i] = 0;
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
MPI_Dims_create(nnodes, ndims, dims);
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* Checking */
|
|
Packit Service |
c5cf8c |
for (i = 0; i < ndims - 1; i++)
|
|
Packit Service |
c5cf8c |
if (dims[i] / 2 > dims[i + 1]) {
|
|
Packit Service |
c5cf8c |
print_err(dims, ndims);
|
|
Packit Service |
c5cf8c |
++errs;
|
|
Packit Service |
c5cf8c |
break;
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
MTest_Finalize(errs);
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
return MTestReturnValue(errs);
|
|
Packit Service |
c5cf8c |
}
|