On Sep 14, 2013, at 12:21 PM, Huangwei <hz...@cam.ac.uk> wrote:

>      do i=1, N-1
>           allocate (QRECS(A(i)))
>           itag = i
>          call mpi_recv(QRECS......., i, itag, .................)
>           deallocate(QRECS)
>      enddo

I assume you're doing more than just allocate/mpi_recv/deallocate.  :-)

I don't know what A(i) is, so it's hard to say whether this is correct or not.

> Will this cause any problem using this way to introducing QRECS?

I don't know.  

Can you make a small program that reproduces the problem?

> Besides, the reasonable why I did not choose mpi_gatherv is that the QRECS 
> will put into YVAR in a non-consecutive way. for instance, if I have 4 
> processors, the first element in YVAR is from rank 0, second from rank 1 
> ......fourth from rank 3, and then fifth from rank 0 again, sixth from rank 1 
> again....... But I will try your suggestion. 

Depending on how big the arrays are, it may still be faster/simpler to 
gather(v) to a single array and copy to the final array.  Shrug.  It depends on 
what your program is doing, and whether that is wort it to you.

To be clear: either way should work fine; there may or may not be coding and/or 
performance implications of each.

-- 
Jeff Squyres
jsquy...@cisco.com
For corporate legal information go to: 
http://www.cisco.com/web/about/doing_business/legal/cri/

Reply via email to