|
Packit Service |
c5cf8c |
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
|
|
Packit Service |
c5cf8c |
/*
|
|
Packit Service |
c5cf8c |
*
|
|
Packit Service |
c5cf8c |
* (C) 2001 by Argonne National Laboratory.
|
|
Packit Service |
c5cf8c |
* See COPYRIGHT in top-level directory.
|
|
Packit Service |
c5cf8c |
*/
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
#include "mpi.h"
|
|
Packit Service |
c5cf8c |
#include <stdio.h>
|
|
Packit Service |
c5cf8c |
#include <stdlib.h>
|
|
Packit Service |
c5cf8c |
#include "mpitest.h"
|
|
Packit Service |
c5cf8c |
#include "mpitestconf.h"
|
|
Packit Service |
c5cf8c |
#ifdef HAVE_STRING_H
|
|
Packit Service |
c5cf8c |
#include <string.h>
|
|
Packit Service |
c5cf8c |
#endif
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
int main(int argc, char *argv[])
|
|
Packit Service |
c5cf8c |
{
|
|
Packit Service |
c5cf8c |
int errs = 0;
|
|
Packit Service |
c5cf8c |
MPI_Comm comm;
|
|
Packit Service |
c5cf8c |
int cnt, rlen;
|
|
Packit Service |
c5cf8c |
char name[MPI_MAX_OBJECT_NAME], nameout[MPI_MAX_OBJECT_NAME];
|
|
Packit Service |
c5cf8c |
MTest_Init(&argc, &argv);
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* Check world and self firt */
|
|
Packit Service |
c5cf8c |
nameout[0] = 0;
|
|
Packit Service |
c5cf8c |
MPI_Comm_get_name(MPI_COMM_WORLD, nameout, &rlen);
|
|
Packit Service |
c5cf8c |
if (strcmp(nameout, "MPI_COMM_WORLD")) {
|
|
Packit Service |
c5cf8c |
errs++;
|
|
Packit Service |
c5cf8c |
printf("Name of comm world is %s, should be MPI_COMM_WORLD\n", nameout);
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
nameout[0] = 0;
|
|
Packit Service |
c5cf8c |
MPI_Comm_get_name(MPI_COMM_SELF, nameout, &rlen);
|
|
Packit Service |
c5cf8c |
if (strcmp(nameout, "MPI_COMM_SELF")) {
|
|
Packit Service |
c5cf8c |
errs++;
|
|
Packit Service |
c5cf8c |
printf("Name of comm self is %s, should be MPI_COMM_SELF\n", nameout);
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* Now, handle other communicators, including world/self */
|
|
Packit Service |
c5cf8c |
cnt = 0;
|
|
Packit Service |
c5cf8c |
while (MTestGetComm(&comm, 1)) {
|
|
Packit Service |
c5cf8c |
if (comm == MPI_COMM_NULL)
|
|
Packit Service |
c5cf8c |
continue;
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
sprintf(name, "comm-%d", cnt);
|
|
Packit Service |
c5cf8c |
cnt++;
|
|
Packit Service |
c5cf8c |
MPI_Comm_set_name(comm, name);
|
|
Packit Service |
c5cf8c |
nameout[0] = 0;
|
|
Packit Service |
c5cf8c |
MPI_Comm_get_name(comm, nameout, &rlen);
|
|
Packit Service |
c5cf8c |
if (strcmp(name, nameout)) {
|
|
Packit Service |
c5cf8c |
errs++;
|
|
Packit Service |
c5cf8c |
printf("Unexpected name, was %s but should be %s\n", nameout, name);
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
MTestFreeComm(&comm);
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
MTest_Finalize(errs);
|
|
Packit Service |
c5cf8c |
return MTestReturnValue(errs);
|
|
Packit Service |
c5cf8c |
}
|