[mpich-discuss] Non-Blocking Send/Recv

ESMAEILI AMIN amin at cavelab.cs.tsukuba.ac.jp
Thu Sep 29 06:04:28 CDT 2011


Dear Prof. Thakur

Hi
 I have a simple program using IRECV and ISEND.
It is running ok, but there is no send and receive between threads!

I`ve attached the program for your information.
also here:

 program ringtopo
    include 'mpif.h'
    integer numtasks, rank, next, prev, buf(2), tag1, tag2, ierr
    integer stats(MPI_STATUS_SIZE,2), reqs(4)
 integer,parameter::buf_size=130
 real CRXi(10000),CP_Sx(buf_size)
 real CP_S6(6,buf_size),CP_r6(6,buf_size),xi(100000)
 integer CP_send,CP_recv,ionsR,Max_p,n_p,LABEL_p,ions

    tag1 = 1
    tag2 = 2
 ions=5000
 do i=1,10000
   CRxi(i)=i*1.0
 end do
    call MPI_INIT(ierr)
    call MPI_COMM_RANK(MPI_COMM_WORLD, rank, ierr)
    call MPI_COMM_SIZE(MPI_COMM_WORLD, numtasks, ierr)
    prev = rank - 1
    next = rank + 1
    if (rank .eq. 0) then
       prev = numtasks - 1
    endif
    if (rank .eq. numtasks - 1) then
       next = 0
    endif
 ionsR=1120
C        do some work
 Max_p=ionsR/buf_size+1
C Max_p=MAXVAL(ionsR)/buf_size+1  !change
 LABEL_p=0
 cp_recv=20
 print*,cp_recv,Max_p,35335
C do 200 n_p=1,Max_p
 CP_send=0
 do i=1,buf_size
 n=LABEL_p+i
 CP_Sx(i)=CRXi(n)
C CP_Sy(i)=CRyi(n)
C CP_Sz(i)=CRzi(n)
C CP_Su(i)=CRui(n)
C CP_Sv(i)=CRvi(n)
C CP_Sw(i)=CRwi(n)
 end do
 CP_send=buf_size
 if(n.gt.ionsR)then
 CP_send=ionsR - LABEL_p
 if (CP_send.lt.0) CP_send=-CP_send
 end if
 LABEL_p=n
 do i=1,buf_size
 CP_S6(1,i)=CP_Sx(i)
C CP_S6(2,i)=CP_Sy(i)
C CP_S6(3,i)=CP_Sz(i)
C CP_S6(4,i)=CP_Su(i)
C CP_S6(5,i)=CP_Sv(i)
C CP_S6(6,i)=CP_Sw(i)
 end do



C print*,mreal,mint,lgrp,CP_send,reqs,1111114
 print*,rank,prev,next,CP_recv,CP_send,11111113
    call MPI_IRECV(CP_recv, 1, MPI_INTEGER, prev, tag1,
     &      MPI_COMM_WORLD, reqs(1), ierr)
    call MPI_IRECV(CP_R6, CP_recv, MPI_REAL, prev, tag2,
     &      MPI_COMM_WORLD, reqs(2), ierr)
    call MPI_ISEND(CP_S6, CP_send, MPI_REAL, next, tag2,
     &     MPI_COMM_WORLD, reqs(3), ierr)
    call MPI_ISEND(CP_send, 1, MPI_INTEGER, next, tag1,
     &     MPI_COMM_WORLD, reqs(4), ierr)
C   call MPI_WAITALL(4, reqs, istatsus, ierr);
 print*,rank,prev,next,CP_recv,CP_send,11111114
 if (CP_recv.gt.0) then
 do n=1,CP_recv
 ions=ions+1
 xi(ions)=CP_R6(1,n)
C yi(ions)=CP_R6(2,n)
C zi(ions)=CP_R6(3,n)
C ui(ions)=CP_R6(4,n)
C vi(ions)=CP_R6(5,n)
C wi(ions)=CP_R6(6,n)
 end do
 else
 print*,777777771,888888881
 End if
C110  continue
C.......................
C200 continue

C   call MPI_WAITALL(4, reqs, stats, ierr);
  call MPI_FINALIZE(ierr)
    end





Kind Regards
Sincerely
Amin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/mpich-discuss/attachments/20110929/baa04bc1/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: passing_ionsR.f
Type: application/octet-stream
Size: 2293 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/mpich-discuss/attachments/20110929/baa04bc1/attachment.obj>


More information about the mpich-discuss mailing list