Commit 46fe18d7 authored by Pavan Balaji's avatar Pavan Balaji
Browse files

Added a nonblocking MPI_Test test.



MPICH currently blocks in MPI_Test.  This test forces a case where the
program will deadlock if MPI_Test is not nonblocking.
Signed-off-by: default avatarXin Zhao <xinzhao3@illinois.edu>
parent 0746bdd3
......@@ -120,7 +120,8 @@ noinst_PROGRAMS = \
mutex_bench_shared \
mutex_bench_shm \
rma-contig \
badrma
badrma \
nb_test
strided_acc_indexed_LDADD = $(LDADD) -lm
strided_acc_onelock_LDADD = $(LDADD) -lm
......
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
/*
* (C) 2001 by Argonne National Laboratory.
* See COPYRIGHT in top-level directory.
*/
#include <stdio.h>
#include <mpi.h>
#include <mpitest.h>
int main(int argc, char *argv[])
{
MPI_Win win;
int flag, tmp, rank;
int base[1024], errs = 0;
MPI_Request req;
MTest_Init(&argc,&argv);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
MPI_Win_create(base, 1024 * sizeof(int), sizeof(int), MPI_INFO_NULL, MPI_COMM_WORLD, &win);
if (rank == 0) {
MPI_Win_lock(MPI_LOCK_EXCLUSIVE, 0, 0, win);
MPI_Barrier(MPI_COMM_WORLD);
MPI_Barrier(MPI_COMM_WORLD);
MPI_Win_unlock(0, win);
}
else {
MPI_Barrier(MPI_COMM_WORLD);
MPI_Win_lock(MPI_LOCK_EXCLUSIVE, 0, 0, win);
MPI_Rput(&tmp, 1, MPI_INT, 0, 0, 1, MPI_INT, win, &req);
MPI_Test(&req, &flag, MPI_STATUS_IGNORE);
MPI_Barrier(MPI_COMM_WORLD);
MPI_Win_unlock(0, win);
}
MPI_Win_free(&win);
MTest_Finalize(errs);
MPI_Finalize();
return 0;
}
......@@ -106,3 +106,4 @@ mutex_bench_shared 4 mpiversion=3.0
mutex_bench_shm 4 mpiversion=3.0
rma-contig 4 mpiversion=3.0 timeLimit=600
badrma 2 mpiversion=3.0
nb_test 2 mpiversion=3.0
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