c - Mpirun hangs when mpi send and recieve is put in a loop -


I was trying to use the program to use mifrewan on 4 node clusters.

Distributing node 0 data in nodes 1, 2 and 3. In the program, from '90 'to variable values ​​of' dior 'to be calculated.

Therefore the node is distributing data and collecting results in an omitted fashion (for different values ​​of var 'dir') when do {*******} Whereas (dir Loop is given, Mippun is hanging, and no output is found. But when I comment on two {*******} (dir The loop output is obtained for the initial value of variable dir dir = -90 ), and that output is correct. The problem occurs when the loop is given.

Can anyone help me in solving this problem.

  #include "mpi.h" int main (int argc, char * argv []) Float dir = -90; Int rank, nanoprakash; MPI_Status status; MPI_Init (& amp; argc, & argv); MPI_Comm_rank (MPI_COMM_WORLD, & amp; Rank); MPI_Comm_size (MPI_COMM_WORLD, & amp; numprocs); If (rank == 0) {/ / data to begin / / (dest = 1; dest & lt; numprocs; dest ++) {MPI_Send (and offset, 1, MPINDT, dist, FAM_Amster, MPIMM_Wirel); MPI_Send (& amp; s_psi [offset], count, MPI_FLOAT, destination, FROM_MASTER, MPI_COMM_WORLD); Gettimeofday (and start, tap); (MPI_Recv (and offset, 1, MPINDT, DEST, FROM_WORKER, MPI_COMM_WORLD, and status); MPI_Recv (& amp; P [Offset], count, MPI_FLOAT for (Dest = 1; dest & lt; numprocs; dest ++) , Destination, FROM_WORKER, MPI_COMM_WORLD, & status);} Gettimeofday (and end, tap); timersub (& end, & begin, & amp; total); Printf ("Time consumption =% ds % Dus \ n ", total.tv_sec, total.tv_usec); dir ++;} while (dir & lt; = 90);} if (rank> 0) {MPI RKEV (and offset, 1, MPIANT, 0 , FOIMASTER, MPIKMM_WRLD, and status); MPI_Recv (& amp; s_psi [offset], count, MPI_FLOAT, 0, FROM_MASTER, MPI_COM M_WORLD, & amp; Position); // What computing} MPI_Send (and offset, 1, MPINDT, 0, FOr_Deker, MPICOMMWWLD); MPI_Send (& amp; P [Offset], Count, MPI_FLOAT, 0, FROM_WORKER, MPI_COMM_WORLD); } MPI_Finalize (); Return 0;}    

part where rank & gt ; 0 must be attached in the loop Each MPI_Send should have its corresponding MPI_Recv.

  if (rank> gt; {} {MPI / RCV (and offset, 1, MPINDT, 0, FOM_Aster, MPICOMM_Wherl, and status); MPI_Recv (& amp; s_psi [offset], count, MPI_FLOAT, 0, FROM_MASTER, MPI_COMM_WORLD, & amp; position); // computing MPI_Send (and offset, 1, MPIANT, 0, FROM_WORKER, MPI_COMM_WORLD); MPI_Send (& amp; P [Offset], Count, MPI_FLOAT, 0, FROM_WORKER, MPI_COMM_WORLD); Dir ++; } While (DIR & LT; = 90); }   

But you probably do not know the worker nodes in dir Generally, we send a magic packet to eliminate the laborers for node 0.

At the end of node 0:

 For  (R = 1; R & lt; answerpox; R ++) MPI_Send (and Dummy, 1, MPIITT, R , Stop, comm);   

for woker nodes:

  if (rank> gt;) {while (true) {mpeg_rakev (and offset, 1, mpiintht, 0 , FROM_MASTER, MPI_COMM_WORLD, & amp; status); MPI_Recv (& amp; s_psi [offset], count, MPI_FLOAT, 0, FROM_MASTER, MPI_COMM_WORLD, & amp; position); // computing MPI_Send (and offset, 1, MPIANT, 0, FROM_WORKER, MPI_COMM_WORLD); MPI_Send (& amp; P [Offset], Count, MPI_FLOAT, 0, FROM_WORKER, MPI_COMM_WORLD); If (MPI_IPROBA (ANIICROOBCAC (AiIICROOCRE, SEOP, COMM, AND FLAG, AND STATES)) (MPI RVCV (and Dummy, 1, MPINDT, AIIICRASE, ROC, COM, NOAAAAUUTUS); breakdown;}}}}   

By default, you do not want to block and send / cancel the blog.

Comments

Popular posts from this blog

python - Does tuple sort itself when looped through -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -