From: bio_amateur on 26 May 2010 22:55 My question is if I use an ALLOCATABLE array as the buffer (unallocated). Should it be allocated before that or the MPI routines (RECV, BCAST...) will automatically allocate and fill the received data to it. Thanks, Tuan
From: glen herrmannsfeldt on 27 May 2010 00:39 bio_amateur <hoangtrongminhtuan(a)gmail.com> wrote: > My question is if I use an ALLOCATABLE array as the buffer > (unallocated). Should it be allocated before that or the MPI routines > (RECV, BCAST...) will automatically allocate and fill the received > data to it. Much of MPI is in C, so unlikely to allocate Fortran allocatables. If you use Fortran wrapper routines, it is possible that they might do that, but I would be surprised. Then again, you can write your own wrapper routines, use C interoperability and Fortran 2003 allocate on assignment (or just check to see what is already allocated) and allocate as needed. -- glen
From: Ian Bush on 27 May 2010 02:44 Aha! An easy one! On 27 May, 03:55, bio_amateur <hoangtrongminht...(a)gmail.com> wrote: > My question is if I use an ALLOCATABLE array as the buffer > (unallocated). Should it be allocated before that Yes. MPI won't allocate it for you. In fact it can't, the latest binding is only f90. > or the MPI routines > (RECV, BCAST...) will automatically allocate and fill the received > data to it. > No. Ian
From: bio_amateur on 27 May 2010 10:21 On May 27, 2:44 am, Ian Bush <ianbush.throwaway.acco...(a)googlemail.com> wrote: > Aha! An easy one! > > On 27 May, 03:55, bio_amateur <hoangtrongminht...(a)gmail.com> wrote: > > > My question is if I use an ALLOCATABLE array as the buffer > > (unallocated). Should it be allocated before that > > Yes. MPI won't allocate it for you. In fact it can't, the latest > binding is only f90. > > > or the MPI routines > > (RECV, BCAST...) will automatically allocate and fill the received > > data to it. > > No. > > Ian Thanks, Ian and Glen.
From: Craig Powers on 28 May 2010 18:11 Ian Bush wrote: > Aha! An easy one! > > On 27 May, 03:55, bio_amateur <hoangtrongminht...(a)gmail.com> wrote: >> My question is if I use an ALLOCATABLE array as the buffer >> (unallocated). Should it be allocated before that > > Yes. MPI won't allocate it for you. In fact it can't, the latest > binding is only f90. Notwithstanding that f90 didn't allow allocatable arguments, I don't think it would even work in a bleeding edge fortran binding without separate and differently-named routines for allocatable and non-allocatable buffers. As I recall, generic interfaces can only distinguish by TKR, so arguments differing only by the presence or absence of the allocatable attribute would not be distinguishable.
|
Pages: 1 Prev: lost of efficiency of operator overloading Next: inequality values |