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.
11 int main(int argc, char **argv)
19 MTest_Init(&argc, &argv);
20 MPI_Comm_size(MPI_COMM_WORLD, &size);
21 MPI_Comm_rank(MPI_COMM_WORLD, &rank);
23 MPI_Comm_get_attr(MPI_COMM_WORLD, MPI_TAG_UB, &v, &flag);
26 fprintf(stderr, "Could not get TAG_UB\n");
32 fprintf(stderr, "Got too-small value (%d) for TAG_UB\n", vval);
36 MPI_Comm_get_attr(MPI_COMM_WORLD, MPI_HOST, &v, &flag);
39 fprintf(stderr, "Could not get HOST\n");
43 if ((vval < 0 || vval >= size) && vval != MPI_PROC_NULL) {
45 fprintf(stderr, "Got invalid value %d for HOST\n", vval);
48 MPI_Comm_get_attr(MPI_COMM_WORLD, MPI_IO, &v, &flag);
51 fprintf(stderr, "Could not get IO\n");
55 if ((vval < 0 || vval >= size) && vval != MPI_ANY_SOURCE && vval != MPI_PROC_NULL) {
57 fprintf(stderr, "Got invalid value %d for IO\n", vval);
61 MPI_Comm_get_attr(MPI_COMM_WORLD, MPI_WTIME_IS_GLOBAL, &v, &flag);
63 /* Wtime need not be set */
65 if (vval < 0 || vval > 1) {
67 fprintf(stderr, "Invalid value for WTIME_IS_GLOBAL (got %d)\n", vval);
71 /* MPI 2.0, section 5.5.3 - MPI_APPNUM should be set if the program is
72 * started with more than one executable name (e.g., in MPMD instead
73 * of SPMD mode). This is independent of the dynamic process routines,
74 * and should be supported even if MPI_COMM_SPAWN and friends are not. */
75 MPI_Comm_get_attr(MPI_COMM_WORLD, MPI_APPNUM, &v, &flag);
76 /* appnum need not be set */
81 fprintf(stderr, "MPI_APPNUM is defined as %d but must be nonnegative\n", vval);
85 /* MPI 2.0 section 5.5.1. MPI_UNIVERSE_SIZE need not be set, but
86 * should be present. */
87 MPI_Comm_get_attr(MPI_COMM_WORLD, MPI_UNIVERSE_SIZE, &v, &flag);
88 /* MPI_UNIVERSE_SIZE need not be set */
90 /* But if it is set, it must be at least the size of comm_world */
94 fprintf(stderr, "MPI_UNIVERSE_SIZE = %d, less than comm world (%d)\n", vval, size);
98 MPI_Comm_get_attr(MPI_COMM_WORLD, MPI_LASTUSEDCODE, &v, &flag);
99 /* Last used code must be defined and >= MPI_ERR_LASTCODE */
102 if (vval < MPI_ERR_LASTCODE) {
105 "MPI_LASTUSEDCODE points to an integer (%d) smaller than MPI_ERR_LASTCODE (%d)\n",
106 vval, MPI_ERR_LASTCODE);
111 fprintf(stderr, "MPI_LASTUSECODE is not defined\n");
114 MTest_Finalize(errs);