On Wed, 9 Oct 2019, Marcin Błażejowski wrote:
The problem is related to 'mpisend' and/or 'mpirecv'
functions in case
we interchange bundles. So, in my example the following piece of code is
problematic (I commented out lines which do not matter):
<hansl>
if $mpirank != 0
Known_models_array_bundle["RES"] = MODEL.known_models_array
mpisend(Known_models_array_bundle, 0)
#delete MODEL
printf("Bundle 'Known_models_array' send to root by (%d)\n",
$mpirank)
else
#known_models_array0 = MODEL.known_models_array
loop i=1..$mpisize-1 --quiet
TMP = mpirecv(i)
known_models_array$i = TMP["RES"]
printf("Bundle 'Known_models_array' received from (%d)\n", i)
endloop
#M.StartModel_b = MODEL.StartModel_b
#M.StartModel_xnames = MODEL.StartModel_xnames
#delete MODEL
endif
</hansl>
Here's a simplified variant of the above:
<hansl>
if $mpirank != 0
bundle b = defbundle("myrank", $mpirank)
mpisend(b, 0)
printf "bundle sent to root by %d\n", $mpirank
else
loop i=1..$mpisize-1 --quiet
b = mpirecv(i)
printf "bundle received from %d\n", i
endloop
endif
</hansl>
Not sure about this, but the above looks like it might be dodgy (get
out of sync somehow). You might try this variant, with a unified loop:
<hansl>
loop i=1..$mpisize-1 --quiet
if i == $mpirank
bundle b = defbundle("myrank", $mpirank)
mpisend(b, 0)
printf "bundle sent to root by %d\n", i
elif $mpirank == 0
b = mpirecv(i)
printf "bundle received from %d\n", i
endif
endloop
</hansl>
Allin