Commit 9d508d5d authored by Lena Oden's avatar Lena Oden
Browse files

Add a isend-irecv test for multiple processors



This test uses irecv and isend to transfer data in
an alltoall manner between multiple processes.
The idea of this test is testing, if MPI can handle
multiple processes trying to connect to each other from
both sides at the same time.
Signed-off-by: default avatarAntonio J. Pena <apenya@mcs.anl.gov>
parent 5324a41f
......@@ -25,6 +25,7 @@ noinst_PROGRAMS = \
cancelanysrc \
isendself \
issendselfcancel \
isendirecv \
sendself \
eagerdt \
isendselfprobe \
......
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
/*
*
* (C) 2015 by Argonne National Laboratory.
* See COPYRIGHT in top-level directory.
*/
#include "mpi.h"
#include <stdlib.h>
#include <stdio.h>
#include "mpitest.h"
int main(int argc, char *argv[])
{
int errors = 0;
int elems = 20;
int rank, nproc, dest, i;
float *in_buf, *out_buf;
MPI_Comm comm;
MPI_Request *reqs;
MTest_Init(&argc, &argv);
comm = MPI_COMM_WORLD;
MPI_Comm_rank(comm, &rank);
MPI_Comm_size(comm, &nproc);
reqs = (MPI_Request *)malloc(2 * nproc * sizeof(MPI_Request));
in_buf = (float *)malloc(elems * nproc * sizeof(float));
out_buf = (float *)malloc(elems * nproc * sizeof(float));
for (i=0; i<nproc; i++) {
MPI_Irecv(&in_buf[elems*i], elems, MPI_FLOAT, i,
0, comm, &reqs[i]);
}
for (i=0; i<nproc; i++) {
MPI_Isend(&out_buf[elems*i], elems, MPI_FLOAT, i, 0,
comm, &reqs[i+nproc]);
}
MPI_Waitall(nproc*2,reqs, MPI_STATUSES_IGNORE);
MTest_Finalize(errors);
MPI_Finalize();
return 0;
}
......@@ -17,6 +17,7 @@ bsendalign 2
bsendpending 2
isendself 1
issendselfcancel 1
isendirecv 10
bsendfrag 2
icsend 4
rqstatus 2
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment