First reported in #573, which proposes changing the default to gather='all' as a workaround. Opening this as a standalone issue to track the underlying bug.
Summary
Under MPI, Projection.get(name, format='array') with a single attribute name and the default gather=True raises IndexError on any non-root rank that holds no local connections for the projection. (Requesting multiple attributes doesn't crash on this path — it returns a wrongly-typed local list instead, via the return values branch.)
The default gather=True only fully populates the result on rank 0; other ranks fall through to return values[0] where values is their raw local connection list, which may be empty.
Reproducer
# mpirun -np 2 python repro.py
import pyNN.nest as sim
sim.setup()
p1 = sim.Population(4, sim.IF_cond_exp())
p2 = sim.Population(4, sim.IF_cond_exp())
prj = sim.Projection(p1, p2, sim.OneToOneConnector(), sim.StaticSynapse(weight=0.1))
# default gather=True, array format, single attribute
weights = prj.get("weight", format="array") # IndexError on a rank with no local connections
sim.end()
Runs fine in serial; under mpirun -np 2 a non-root rank with no local connections raises:
File ".../pyNN/common/projections.py", line 397, in get
return values[0]
IndexError: list index out of range
First reported in #573, which proposes changing the default to
gather='all'as a workaround. Opening this as a standalone issue to track the underlying bug.Summary
Under MPI,
Projection.get(name, format='array')with a single attribute name and the defaultgather=TrueraisesIndexErroron any non-root rank that holds no local connections for the projection. (Requesting multiple attributes doesn't crash on this path — it returns a wrongly-typed local list instead, via thereturn valuesbranch.)The default
gather=Trueonly fully populates the result on rank 0; other ranks fall through toreturn values[0]wherevaluesis their raw local connection list, which may be empty.Reproducer
Runs fine in serial; under
mpirun -np 2a non-root rank with no local connections raises: