<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Sending, receiving result in deadlock in Intel® MPI Library</title>
    <link>https://community.intel.com/t5/Intel-MPI-Library/Sending-receiving-result-in-deadlock/m-p/830607#M1322</link>
    <description>I'm trying to solve a simple problem with MPI but when I comment all the
 PRINT lines the program gets into a deadlock, when I uncomment one of 
them then the programm proceeds smoothly!!!! I can't understand what is 
wrong with this? I'm using blocking send and receive so time difference 
that print makes should not has any effect on the overal performance!&lt;BR /&gt;The
 idea of IF is that odd processes first send and evens recieve then vice
 versa, so there should not be any deadlock even if there don't be any 
buffer on the way!&lt;BR /&gt;What is wrong with my algorithm that makes it break?&lt;BR /&gt;&lt;BR /&gt;&lt;PRE&gt;[bash] integer,parameter   ::IM=100,JM=100  
 REAL,ALLOCATABLE  ::T(:,:),TF(:,:)  
 ..  
  CALL MPI_COMM_RANK(MPI_COMM_WORLD,RNK,IERR)  
  CALL MPI_COMM_SIZE(MPI_COMM_WORLD,SIZ,IERR)  
 ..  
 prv = rnk-1  
 nxt = rnk+1  
 LIM = INT(IM/SIZ)  
 IF (rnk==0) THEN  
     ALLOCATE(TF(IM,JM))  
     prv = MPI_PROC_NULL  
 ELSEIF(rnk==siz-1) THEN  
     NXT = MPI_PROC_NULL  
     LIM = LIM+MOD(IM,SIZ)  
 END IF  
 ALLOCATE(T(LIM+2,JM+2))  
   
 IF (MOD(RNK,2)==0) THEN  
         CALL MPI_SEND(T(2,:),JM+2,MPI_REAL,PRV,10,MPI_COMM_WORLD,IERR)  
         !PRINT*,RNK,'SENT'  
         CALL MPI_RECV(T(1,:),JM+2,MPI_REAL,PRV,20,MPI_COMM_WORLD,STAT,IERR)  
         !PRINT*,RNK,'RECIEVED'  
     ELSE  
         CALL MPI_RECV(T(LIM+2,:),JM+2,MPI_REAL,NXT,10,MPI_COMM_WORLD,STAT,IERR)  
         PRINT*,RNK,'RECIEVED'  
        CALL MPI_SEND(T(LIM+1,:),JM+2,MPI_REAL,NXT,20,MPI_COMM_WORLD,IERR)  
         !PRINT*,RNK,'SENT'  
     END IF [/bash]&lt;/PRE&gt;</description>
    <pubDate>Tue, 04 Jan 2011 07:05:19 GMT</pubDate>
    <dc:creator>anishtain4</dc:creator>
    <dc:date>2011-01-04T07:05:19Z</dc:date>
    <item>
      <title>Sending, receiving result in deadlock</title>
      <link>https://community.intel.com/t5/Intel-MPI-Library/Sending-receiving-result-in-deadlock/m-p/830607#M1322</link>
      <description>I'm trying to solve a simple problem with MPI but when I comment all the
 PRINT lines the program gets into a deadlock, when I uncomment one of 
them then the programm proceeds smoothly!!!! I can't understand what is 
wrong with this? I'm using blocking send and receive so time difference 
that print makes should not has any effect on the overal performance!&lt;BR /&gt;The
 idea of IF is that odd processes first send and evens recieve then vice
 versa, so there should not be any deadlock even if there don't be any 
buffer on the way!&lt;BR /&gt;What is wrong with my algorithm that makes it break?&lt;BR /&gt;&lt;BR /&gt;&lt;PRE&gt;[bash] integer,parameter   ::IM=100,JM=100  
 REAL,ALLOCATABLE  ::T(:,:),TF(:,:)  
 ..  
  CALL MPI_COMM_RANK(MPI_COMM_WORLD,RNK,IERR)  
  CALL MPI_COMM_SIZE(MPI_COMM_WORLD,SIZ,IERR)  
 ..  
 prv = rnk-1  
 nxt = rnk+1  
 LIM = INT(IM/SIZ)  
 IF (rnk==0) THEN  
     ALLOCATE(TF(IM,JM))  
     prv = MPI_PROC_NULL  
 ELSEIF(rnk==siz-1) THEN  
     NXT = MPI_PROC_NULL  
     LIM = LIM+MOD(IM,SIZ)  
 END IF  
 ALLOCATE(T(LIM+2,JM+2))  
   
 IF (MOD(RNK,2)==0) THEN  
         CALL MPI_SEND(T(2,:),JM+2,MPI_REAL,PRV,10,MPI_COMM_WORLD,IERR)  
         !PRINT*,RNK,'SENT'  
         CALL MPI_RECV(T(1,:),JM+2,MPI_REAL,PRV,20,MPI_COMM_WORLD,STAT,IERR)  
         !PRINT*,RNK,'RECIEVED'  
     ELSE  
         CALL MPI_RECV(T(LIM+2,:),JM+2,MPI_REAL,NXT,10,MPI_COMM_WORLD,STAT,IERR)  
         PRINT*,RNK,'RECIEVED'  
        CALL MPI_SEND(T(LIM+1,:),JM+2,MPI_REAL,NXT,20,MPI_COMM_WORLD,IERR)  
         !PRINT*,RNK,'SENT'  
     END IF [/bash]&lt;/PRE&gt;</description>
      <pubDate>Tue, 04 Jan 2011 07:05:19 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-MPI-Library/Sending-receiving-result-in-deadlock/m-p/830607#M1322</guid>
      <dc:creator>anishtain4</dc:creator>
      <dc:date>2011-01-04T07:05:19Z</dc:date>
    </item>
    <item>
      <title>Sending, receiving result in deadlock</title>
      <link>https://community.intel.com/t5/Intel-MPI-Library/Sending-receiving-result-in-deadlock/m-p/830608#M1323</link>
      <description>Hi Anishtain,&lt;BR /&gt;&lt;BR /&gt;Your code (a bit modified) below works fine for number of processes from 2 to 16 on Intel64.&lt;BR /&gt;Do you define all variables? SIZ may be a real variable.&lt;BR /&gt;&lt;BR /&gt; implicit none&lt;BR /&gt; include 'mpif.h'&lt;BR /&gt; &lt;BR /&gt; integer,parameter :: IM=100,JM=100 &lt;BR /&gt; REAL,ALLOCATABLE :: T(:,:),TF(:,:) &lt;BR /&gt; integer RNK,IERR,SIZ, prv, nxt, LIM&lt;BR /&gt; integer STAT(MPI_STATUS_SIZE)&lt;BR /&gt; &lt;BR /&gt; CALL MPI_INIT(IERR)&lt;BR /&gt; &lt;BR /&gt; CALL MPI_COMM_RANK(MPI_COMM_WORLD,RNK,IERR) &lt;BR /&gt; CALL MPI_COMM_SIZE(MPI_COMM_WORLD,SIZ,IERR) &lt;BR /&gt;&lt;BR /&gt; prv = rnk-1 &lt;BR /&gt; nxt = rnk+1 &lt;BR /&gt; &lt;BR /&gt; LIM = INT(IM/SIZ) &lt;BR /&gt; &lt;BR /&gt; IF (rnk==0) THEN &lt;BR /&gt; ALLOCATE(TF(IM,JM)) &lt;BR /&gt; prv = MPI_PROC_NULL&lt;BR /&gt; &lt;BR /&gt; ELSEIF(rnk==siz-1) THEN &lt;BR /&gt; NXT = MPI_PROC_NULL &lt;BR /&gt; LIM = LIM+MOD(IM,SIZ) &lt;BR /&gt; &lt;BR /&gt; END IF &lt;BR /&gt; &lt;BR /&gt; ALLOCATE(T(LIM+2,JM+2)) &lt;BR /&gt; &lt;BR /&gt; IF (MOD(RNK,2)==0) THEN &lt;BR /&gt; CALL MPI_SEND(T(2,:),JM+2,MPI_REAL,PRV,10,MPI_COMM_WORLD,IERR) &lt;BR /&gt; !PRINT*,RNK,'SENT' &lt;BR /&gt; CALL MPI_RECV(T(1,:),JM+2,MPI_REAL,PRV,20,MPI_COMM_WORLD,STAT,IERR) &lt;BR /&gt; !PRINT*,RNK,'RECIEVED' &lt;BR /&gt; ELSE &lt;BR /&gt; CALL MPI_RECV(T(LIM+2,:),JM+2,MPI_REAL,NXT,10,MPI_COMM_WORLD,STAT,IERR) &lt;BR /&gt; !PRINT*,RNK,'RECIEVED' &lt;BR /&gt; CALL MPI_SEND(T(LIM+1,:),JM+2,MPI_REAL,NXT,20,MPI_COMM_WORLD,IERR) &lt;BR /&gt; !PRINT*,RNK,'SENT' &lt;BR /&gt; END IF &lt;BR /&gt; &lt;BR /&gt; IF (rnk==0) DEALLOCATE(TF)&lt;BR /&gt; &lt;BR /&gt; DEALLOCATE(T)&lt;BR /&gt; &lt;BR /&gt; call MPI_FINALIZE(IERR)&lt;BR /&gt; &lt;BR /&gt; print *, rnk, " - done"&lt;BR /&gt; &lt;BR /&gt;END PROGRAM&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt; Dmitry&lt;BR /&gt;</description>
      <pubDate>Wed, 12 Jan 2011 13:07:06 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-MPI-Library/Sending-receiving-result-in-deadlock/m-p/830608#M1323</guid>
      <dc:creator>Dmitry_K_Intel2</dc:creator>
      <dc:date>2011-01-12T13:07:06Z</dc:date>
    </item>
    <item>
      <title>Sending, receiving result in deadlock</title>
      <link>https://community.intel.com/t5/Intel-MPI-Library/Sending-receiving-result-in-deadlock/m-p/830609#M1324</link>
      <description>Thanks Dmitry, the problem was with the optimization as I found by someone's advice. I just added the -O0 and it works. siz was integer btw.&lt;BR /&gt;</description>
      <pubDate>Sat, 15 Jan 2011 09:04:57 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-MPI-Library/Sending-receiving-result-in-deadlock/m-p/830609#M1324</guid>
      <dc:creator>anishtain4</dc:creator>
      <dc:date>2011-01-15T09:04:57Z</dc:date>
    </item>
  </channel>
</rss>

