Arquivos
mpich/test/mpi/pt2pt/anyall.c
T
Shintaro Iwasaki 5ef6367f73 use more inclusive terms in the code
Specifically, this patch makes the following changes.
build scripts:
- master_top_srcdir -> main_top_srcdir
Git:
- "master" -> "main" branch (variable names and comments)
global structures and variables:
- MPIR_ThreadInfo.master_thread -> MPIR_ThreadInfo.main_thread
- struct PMIMaster -> struct PMIMain
- PMI2_Connect_comm_t.isMaster -> PMI2_Connect_comm_t.isMain
names of tests:
- spawntest_master -> spawntest_parent
- taskmaster -> taskmanager
- th_taskmaster -> th_taskmanager`
comments and names of temporary/local variables:
- master -> main, parent, server, ...
- slave -> child, worker, client, ...
2020-06-30 15:02:48 -05:00

84 linhas
2.4 KiB
C

/*
* Copyright (C) by Argonne National Laboratory
* See COPYRIGHT in top-level directory
*/
#include "mpi.h"
#include <stdio.h>
#include <stdlib.h>
#include "mpitest.h"
#define MAX_MSGS 30
/*
static char MTEST_Descrip[] = "One implementation delivered incorrect data when an MPI recieve uses both ANY_SOURCE and ANY_TAG";
*/
int main(int argc, char *argv[])
{
int wrank, wsize, sender, receiver, i, j, idx, count;
int errs = 0;
MPI_Request r[MAX_MSGS];
int buf[MAX_MSGS][MAX_MSGS];
MPI_Comm comm;
MPI_Status status;
MTest_Init(&argc, &argv);
MPI_Comm_rank(MPI_COMM_WORLD, &wrank);
MPI_Comm_size(MPI_COMM_WORLD, &wsize);
comm = MPI_COMM_WORLD;
sender = 0;
receiver = 1;
/* The test takes advantage of the ordering rules for messages */
if (wrank == sender) {
/* Initialize the send buffer */
for (i = 0; i < MAX_MSGS; i++) {
for (j = 0; j < MAX_MSGS; j++) {
buf[i][j] = i * MAX_MSGS + j;
}
}
MPI_Barrier(MPI_COMM_WORLD);
for (i = 0; i < MAX_MSGS; i++) {
MPI_Send(buf[i], MAX_MSGS - i, MPI_INT, receiver, 3, comm);
}
} else if (wrank == receiver) {
/* Initialize the recv buffer */
for (i = 0; i < MAX_MSGS; i++) {
for (j = 0; j < MAX_MSGS; j++) {
buf[i][j] = -1;
}
}
for (i = 0; i < MAX_MSGS; i++) {
MPI_Irecv(buf[i], MAX_MSGS - i, MPI_INT, MPI_ANY_SOURCE, MPI_ANY_TAG, comm, &r[i]);
}
MPI_Barrier(MPI_COMM_WORLD);
for (i = 0; i < MAX_MSGS; i++) {
MPI_Waitany(MAX_MSGS, r, &idx, &status);
/* Message idx should have length MAX_MSGS-idx */
MPI_Get_count(&status, MPI_INT, &count);
if (count != MAX_MSGS - idx) {
errs++;
} else {
/* Check for the correct answers */
for (j = 0; j < MAX_MSGS - idx; j++) {
if (buf[idx][j] != idx * MAX_MSGS + j) {
errs++;
printf("Message %d [%d] is %d, should be %d\n",
idx, j, buf[idx][j], idx * MAX_MSGS + j);
}
}
}
}
} else {
MPI_Barrier(MPI_COMM_WORLD);
}
MTest_Finalize(errs);
return MTestReturnValue(errs);
}