Am 16.02.2015 um 17:58 schrieb Allin Cottrell:
On Mon, 16 Feb 2015, Sven Schreiber wrote:
> Advancing line-by-line here... Next error below the sample script:
>
> <hansl>
> mpi --np=2
> if $mpirank == 0 # parent process
> matrix b = ones(1000,1)
> matrix a = zeros(1000,1)
> endif
> # -- up to here no errors --
>
> # divide up the input data
> mpiscatter(&b, byrows)
The trouble here is that the matrices a and b exist only in the rank 0
process; they need to exist everywhere.
<hansl>
mpi --np=2
matrix a
matrix b
if $mpirank == 0
b = ones(1000,1)
a = zeros(1000,1)
endif
mpiscatter(&b, byrows)
</hansl>
Hm, ok I understand. My spontaneous reaction would be: "but isn't this
what mpiscatter (or mpibroadcast) is supposed to achieve as part of
their job?".
What's the value added of requiring the pre-existence of the recipient
objects? It can't be the danger of name clashes, because AFAICS they are
not avoided this way, either. Or would it raise an error if the b matrix
in some other processes already contained other data and were overwritten?
thanks,
sven