15{
16 int i, Iam, Np;
20 MPI_Group wgrp, mgrp;
21 MPI_Status stat;
22
26 {
27 fprintf(stderr,
"Not enough processes to run sanity check; need %d, but I've only got %d\n",
NPROC, Np);
29 }
30
31 for (i=0; i !=
WASTE_SIZE; i++) WasteOfSpace[i] = 0.0;
32
33
34
35 for (i=0; i !=
NPROC; i++) irank[i] = i;
37 MPI_Group_incl(wgrp,
NPROC, irank, &mgrp);
39 MPI_Group_free(&mgrp);
40
41
42
43 if (mcom != MPI_COMM_NULL)
44 {
46
47
48
49 if (Iam % 2)
50 {
51 MPI_Recv(&i, 1, MPI_INT, (
NPROC+Iam-1)%
NPROC, 0, mcom, &stat);
52 MPI_Send(&Iam, 1, MPI_INT, (Iam+1)%
NPROC, 0, mcom);
53 }
54 else
55 {
56 MPI_Send(&Iam, 1, MPI_INT, (Iam+1)%
NPROC, 0, mcom);
57 MPI_Recv(&i, 1, MPI_INT, (
NPROC+Iam-1)%
NPROC, 0, mcom, &stat);
58 }
59
60
61
63 {
64 fprintf(stderr, "Communication does not seem to work properly!!\n");
66 }
67 }
68 fprintf(stdout, "%d: C MPI sanity test passed\n", Iam);
70 exit(0);
71}
LIBSEQ_INT LIBSEQ_CALL MPI_Comm_rank(LIBSEQ_INT comm, LIBSEQ_INT *rank)
LIBSEQ_INT LIBSEQ_CALL MPI_Finalize(void)
static MPI_Comm MPI_COMM_WORLD
LIBSEQ_INT LIBSEQ_CALL MPI_Init(LIBSEQ_INT *pargc, char ***pargv)