Am 16.02.2015 um 19:21 schrieb Allin Cottrell:
On Mon, 16 Feb 2015, Sven Schreiber wrote:
>
> But since we're on the gretl list my comment was aimed at the hansl
> wrapper implementation: Why can't hansl see the &b in mpiscatter(&b,
> byrows) and shout out: "Hey I've seen this b before, it was created in
> line xyz, and now everybody's getting it, too." I mean this look-up of
> existing objects is what the interpreter does all the time, no?
Not really. If you do the following, which seems analogous to me,
<hansl>
if 0
matrix b = I(3)
endif
print b
</hansl>
you'll get an error since b was never actually defined. And
if $mpirank == 0
is just like "if 0" from the point of view of all MPI processes other
than root.
Yes -- but that's where the literal meaning of "broadcast" or
"scatter"
comes in IMO: The whole purpose of these functions is to take something
that doesn't exist in other processes yet and copy it over there. So
it's a function that creates something in the subprocesses. In principle
that could also be written as (with non-existing syntax):
matrix b = mpibroadcast(b[$mpirank==0])
and this would make it completely clear that this creates b in all
"ranks". (I'm not suggesting this syntax change, it's just for the sake
of the argument.) From this point of view I think the empty
pre-declaration could be redundant.
cheers,
sven