1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
4 * (C) 2001 by Argonne National Laboratory.
5 * See COPYRIGHT in top-level directory.
12 #include "mpitestconf.h"
17 int main(int argc, char *argv[])
22 char name[MPI_MAX_OBJECT_NAME], nameout[MPI_MAX_OBJECT_NAME];
23 MTest_Init(&argc, &argv);
25 /* Check world and self firt */
27 MPI_Comm_get_name(MPI_COMM_WORLD, nameout, &rlen);
28 if (strcmp(nameout, "MPI_COMM_WORLD")) {
30 printf("Name of comm world is %s, should be MPI_COMM_WORLD\n", nameout);
34 MPI_Comm_get_name(MPI_COMM_SELF, nameout, &rlen);
35 if (strcmp(nameout, "MPI_COMM_SELF")) {
37 printf("Name of comm self is %s, should be MPI_COMM_SELF\n", nameout);
40 /* Now, handle other communicators, including world/self */
42 while (MTestGetComm(&comm, 1)) {
43 if (comm == MPI_COMM_NULL)
46 sprintf(name, "comm-%d", cnt);
48 MPI_Comm_set_name(comm, name);
50 MPI_Comm_get_name(comm, nameout, &rlen);
51 if (strcmp(name, nameout)) {
53 printf("Unexpected name, was %s but should be %s\n", nameout, name);