Re: OpenMP and allocation and intent(out)

ralf <ralf.schaa@xxxxxxxxx> wrote:

Anyway, the actual code that I would like to parallelize (not paralyze
as the spell checker suggests) calls subroutines with an allocatable
intent(out). So that is really what i was inquiring. I am not sure yet
whether it should be 'shared' or 'private' ... so i will read some
more in Chapman's book and probably ask more later.

It doesn't make sense if it is shared.

Really, intent(out) allocatables should only be used when the size
needs to be computed inside the called routine. In your example
they (all N of them) are size N.

Someone will note if I am wrong, but I believe you can do it
with an array of structure with an allocatable member.
Then pass one allocatable to each instance of cook.

type this
integer, allocatable:: eggs(:)
end type this
type(this), allocatable :: eggarray(:)

do i=1,n
call cook(eggarray(i)%eggs(:))

(eggarray doesn't need to be allocatable, but it can be.)

and, as usual, there needs to be an explicit interface
for subroutines with allocatable arguments. (I don't remember
if that was shown in the original post.)

-- glen