From: glen herrmannsfeldt on
Tom <flurboglarf(a)mailinator.com> wrote:

> On Dec 3, 8:42?pm, glen herrmannsfeldt <g...(a)ugcs.caltech.edu> wrote:
>> The thing you have to watch out for is aliasing and copy-in/copy-out,
>> especially in the case of multiple processors running on the same data.
>> If on the parallel runs two different processors write to the same
>> data without the appropriate interlocks, you will get the wrong answer.

> Ok, but I don't see where that would happen here. The a arrays on the
> individual nodes don't overlap, and I would expect that MPI_GATHER
> takes care of the data not being written to the same address. The size
> of atot is exactly an integer multiple of the size of the transferred

Without the SUBROUTINE statements and the declaration for all
the variables, it is pretty hard to tell. Also, the rest of
the subroutine.

> a. Isn't it the purpose of MPI_GATHER to avoid precisely the
> trap of writing to the same data?

Well, yes, but it is supposed to do that within the C aliasing rules.
If you call a Fortran routine that calls ggather() it is not so
obvious that you can depend on that. Under some conditions Fortran
will make a copy of the array and pass that. The order that
it is copied back might be different than you expect.

-- glen
From: robin on
"Tom" <flurboglarf(a)mailinator.com> wrote in message
news:c66b2f97-6210-4b64-a85c-3f0bf3eed828(a)c3g2000yqd.googlegroups.com...
On Dec 3, 9:40 pm, "robin" <robi...(a)bigpond.com> wrote:
> You need explicit interfaces for each of the subroutines.

>Why? I don't think so, I don't have optional arguments or such there,
>and as I said, the subroutine works well in single-CPU mode.

Two reasons:
1. You have shown us only a few statements.
We have to guess what your problem could be.
It's like someone complaining that the car won't start,
but without our being able to try to start the car
and without our being able to look under the bonnet.
2. Your program behaves erratically.

It will depend on how you define the dummy parameters
in ggather.
I suggested explicit interface would be needed as something
to provide checks.

You haven't shown declarations for all variables.
Explicit interface will enable checks to be carried out.
Type mismatch is a common ailment.
As you don't have explicit interface, you can't
rule that out as a source of error.