From 7b8a85ea46bf4709ca3522e3f87e67c784016986 Mon Sep 17 00:00:00 2001 From: Jan Vales Date: Mon, 30 Jan 2012 18:38:50 +0100 Subject: [PATCH] fix'd deadlock if there is just 1 node. --- scan/runAll.sh | 2 +- scan/scan.c | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/scan/runAll.sh b/scan/runAll.sh index c57462b..dabdbb1 100755 --- a/scan/runAll.sh +++ b/scan/runAll.sh @@ -22,7 +22,7 @@ for nno in $NODELIST; do for nnnp in $NNPLIST; do for i in $RUNLIST; do if [ "$nno" -eq "0" ] ; then - nno=2 + nno=1 fi if [ "$nnnp" -eq "0" ] ; then nnnp=1 diff --git a/scan/scan.c b/scan/scan.c index 0f5badd..35446c1 100755 --- a/scan/scan.c +++ b/scan/scan.c @@ -48,6 +48,7 @@ int main(int argc, char *argv[]){ int tmp2; FILE *file = NULL; MPI_Request request; + MPI_Status status; unsigned long blocksize; unsigned long *databuf; @@ -216,7 +217,7 @@ int main(int argc, char *argv[]){ if(tmp >= nodes) tmp = 0; tmp2 = ((rank+1)*blocksize); if(tmp2 > size) tmp2 = size; - MPI_Send(databuf, tmp2, MPI_LONG, tmp, KEY, MPI_COMM_WORLD); + MPI_Isend(databuf, tmp2, MPI_LONG, tmp, KEY, MPI_COMM_WORLD,&request); /* receive result by root */ if(rank == 0){ @@ -234,6 +235,7 @@ int main(int argc, char *argv[]){ if(endTime == 0) endTime = MPI_Wtime(); fprintf(stdout, "[%d/%d:%s] timings: prep:%f algo:%f postp:%f end:%f\n",rank,nodes,name,prepTime-startTime,algoTime-startTime,postpTime-startTime,endTime-startTime); #endif + MPI_Wait(&request, &status); MPI_Finalize(); return 0; } -- 2.43.0