|
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 |
#include <stdio.h>
|
|
Packit Service |
c5cf8c |
#include "mpi.h"
|
|
Packit Service |
c5cf8c |
#include "mpitest.h"
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
void MissingKeyval(int rc, const char keyname[]);
|
|
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 rc;
|
|
Packit Service |
c5cf8c |
void *v;
|
|
Packit Service |
c5cf8c |
int flag;
|
|
Packit Service |
c5cf8c |
int vval;
|
|
Packit Service |
c5cf8c |
int rank, size;
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
MTest_Init(&argc, &argv);
|
|
Packit Service |
c5cf8c |
MPI_Comm_size(MPI_COMM_WORLD, &size);
|
|
Packit Service |
c5cf8c |
MPI_Comm_rank(MPI_COMM_WORLD, &rank;;
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* Set errors return so that we can provide better information
|
|
Packit Service |
c5cf8c |
* should a routine reject one of the attribute values */
|
|
Packit Service |
c5cf8c |
MPI_Errhandler_set(MPI_COMM_WORLD, MPI_ERRORS_RETURN);
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
rc = MPI_Attr_get(MPI_COMM_WORLD, MPI_TAG_UB, &v, &flag;;
|
|
Packit Service |
c5cf8c |
if (rc) {
|
|
Packit Service |
c5cf8c |
MissingKeyval(rc, "MPI_TAG_UB");
|
|
Packit Service |
c5cf8c |
errs++;
|
|
Packit Service |
c5cf8c |
} else {
|
|
Packit Service |
c5cf8c |
if (!flag) {
|
|
Packit Service |
c5cf8c |
errs++;
|
|
Packit Service |
c5cf8c |
fprintf(stderr, "Could not get TAG_UB\n");
|
|
Packit Service |
c5cf8c |
} else {
|
|
Packit Service |
c5cf8c |
vval = *(int *) v;
|
|
Packit Service |
c5cf8c |
if (vval < 32767) {
|
|
Packit Service |
c5cf8c |
errs++;
|
|
Packit Service |
c5cf8c |
fprintf(stderr, "Got too-small value (%d) for TAG_UB\n", vval);
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
rc = MPI_Attr_get(MPI_COMM_WORLD, MPI_HOST, &v, &flag;;
|
|
Packit Service |
c5cf8c |
if (rc) {
|
|
Packit Service |
c5cf8c |
MissingKeyval(rc, "MPI_HOST");
|
|
Packit Service |
c5cf8c |
errs++;
|
|
Packit Service |
c5cf8c |
} else {
|
|
Packit Service |
c5cf8c |
if (!flag) {
|
|
Packit Service |
c5cf8c |
errs++;
|
|
Packit Service |
c5cf8c |
fprintf(stderr, "Could not get HOST\n");
|
|
Packit Service |
c5cf8c |
} else {
|
|
Packit Service |
c5cf8c |
vval = *(int *) v;
|
|
Packit Service |
c5cf8c |
if ((vval < 0 || vval >= size) && vval != MPI_PROC_NULL) {
|
|
Packit Service |
c5cf8c |
errs++;
|
|
Packit Service |
c5cf8c |
fprintf(stderr, "Got invalid value %d for HOST\n", vval);
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
rc = MPI_Attr_get(MPI_COMM_WORLD, MPI_IO, &v, &flag;;
|
|
Packit Service |
c5cf8c |
if (rc) {
|
|
Packit Service |
c5cf8c |
MissingKeyval(rc, "MPI_IO");
|
|
Packit Service |
c5cf8c |
errs++;
|
|
Packit Service |
c5cf8c |
} else {
|
|
Packit Service |
c5cf8c |
if (!flag) {
|
|
Packit Service |
c5cf8c |
errs++;
|
|
Packit Service |
c5cf8c |
fprintf(stderr, "Could not get IO\n");
|
|
Packit Service |
c5cf8c |
} else {
|
|
Packit Service |
c5cf8c |
vval = *(int *) v;
|
|
Packit Service |
c5cf8c |
if ((vval < 0 || vval >= size) && vval != MPI_ANY_SOURCE && vval != MPI_PROC_NULL) {
|
|
Packit Service |
c5cf8c |
errs++;
|
|
Packit Service |
c5cf8c |
fprintf(stderr, "Got invalid value %d for IO\n", vval);
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
rc = MPI_Attr_get(MPI_COMM_WORLD, MPI_WTIME_IS_GLOBAL, &v, &flag;;
|
|
Packit Service |
c5cf8c |
if (rc) {
|
|
Packit Service |
c5cf8c |
MissingKeyval(rc, "MPI_WTIME_IS_GLOBAL");
|
|
Packit Service |
c5cf8c |
errs++;
|
|
Packit Service |
c5cf8c |
} else {
|
|
Packit Service |
c5cf8c |
if (flag) {
|
|
Packit Service |
c5cf8c |
/* Wtime need not be set */
|
|
Packit Service |
c5cf8c |
vval = *(int *) v;
|
|
Packit Service |
c5cf8c |
if (vval < 0 || vval > 1) {
|
|
Packit Service |
c5cf8c |
errs++;
|
|
Packit Service |
c5cf8c |
fprintf(stderr, "Invalid value for WTIME_IS_GLOBAL (got %d)\n", vval);
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
rc = MPI_Attr_get(MPI_COMM_WORLD, MPI_APPNUM, &v, &flag;;
|
|
Packit Service |
c5cf8c |
if (rc) {
|
|
Packit Service |
c5cf8c |
MissingKeyval(rc, "MPI_APPNUM");
|
|
Packit Service |
c5cf8c |
errs++;
|
|
Packit Service |
c5cf8c |
} else {
|
|
Packit Service |
c5cf8c |
/* appnum need not be set */
|
|
Packit Service |
c5cf8c |
if (flag) {
|
|
Packit Service |
c5cf8c |
vval = *(int *) v;
|
|
Packit Service |
c5cf8c |
if (vval < 0) {
|
|
Packit Service |
c5cf8c |
errs++;
|
|
Packit Service |
c5cf8c |
fprintf(stderr, "MPI_APPNUM is defined as %d but must be nonnegative\n", vval);
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
rc = MPI_Attr_get(MPI_COMM_WORLD, MPI_UNIVERSE_SIZE, &v, &flag;;
|
|
Packit Service |
c5cf8c |
if (rc) {
|
|
Packit Service |
c5cf8c |
MissingKeyval(rc, "MPI_UNIVERSE_SIZE");
|
|
Packit Service |
c5cf8c |
errs++;
|
|
Packit Service |
c5cf8c |
} else {
|
|
Packit Service |
c5cf8c |
/* MPI_UNIVERSE_SIZE need not be set */
|
|
Packit Service |
c5cf8c |
if (flag) {
|
|
Packit Service |
c5cf8c |
vval = *(int *) v;
|
|
Packit Service |
c5cf8c |
if (vval < size) {
|
|
Packit Service |
c5cf8c |
errs++;
|
|
Packit Service |
c5cf8c |
fprintf(stderr, "MPI_UNIVERSE_SIZE = %d, less than comm world (%d)\n", vval, size);
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
rc = MPI_Attr_get(MPI_COMM_WORLD, MPI_LASTUSEDCODE, &v, &flag;;
|
|
Packit Service |
c5cf8c |
if (rc) {
|
|
Packit Service |
c5cf8c |
MissingKeyval(rc, "MPI_LASTUSEDCODE");
|
|
Packit Service |
c5cf8c |
errs++;
|
|
Packit Service |
c5cf8c |
} else {
|
|
Packit Service |
c5cf8c |
/* Last used code must be defined and >= MPI_ERR_LASTCODE */
|
|
Packit Service |
c5cf8c |
if (flag) {
|
|
Packit Service |
c5cf8c |
vval = *(int *) v;
|
|
Packit Service |
c5cf8c |
if (vval < MPI_ERR_LASTCODE) {
|
|
Packit Service |
c5cf8c |
errs++;
|
|
Packit Service |
c5cf8c |
fprintf(stderr,
|
|
Packit Service |
c5cf8c |
"MPI_LASTUSEDCODE points to an integer (%d) smaller than MPI_ERR_LASTCODE (%d)\n",
|
|
Packit Service |
c5cf8c |
vval, MPI_ERR_LASTCODE);
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
} else {
|
|
Packit Service |
c5cf8c |
errs++;
|
|
Packit Service |
c5cf8c |
fprintf(stderr, "MPI_LASTUSECODE is not defined\n");
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
MPI_Errhandler_set(MPI_COMM_WORLD, MPI_ERRORS_ARE_FATAL);
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
MTest_Finalize(errs);
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
return MTestReturnValue(errs);
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
void MissingKeyval(int errcode, const char keyname[])
|
|
Packit Service |
c5cf8c |
{
|
|
Packit Service |
c5cf8c |
int errclass, slen;
|
|
Packit Service |
c5cf8c |
char string[MPI_MAX_ERROR_STRING];
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
MPI_Error_class(errcode, &errclass);
|
|
Packit Service |
c5cf8c |
MPI_Error_string(errcode, string, &slen);
|
|
Packit Service |
c5cf8c |
printf("For key %s: Error class %d (%s)\n", keyname, errclass, string);
|
|
Packit Service |
c5cf8c |
fflush(stdout);
|
|
Packit Service |
c5cf8c |
}
|