Network Element Allocation on Loihi


I am trying to understand how various elements are mapped from Nengo onto the Loihi simulator backend. When I create a network of a few ensembles with simple connections (not direct) and inspect the validate_block function with a debugger as the network is built, I see that LoihiBlock objects are created for each of the ensembles, ensemble connections, and any probes of decoded ensemble output.

From what I’ve seen elsewhere in the docs/forum, I understand that Ensembles are currently translated to one Loihi core each. Is this the same process for every LoihiBlock object? Using the below example, since there are seven LoihiBlocks created does that mean that running this on an actual Loihi chip would use seven physical cores, or do different types of LoihiBlocks get mapped to different locations (snips or superhost)?

import numpy as np
import nengo
import nengo_loihi


net = nengo.Network(label='Example Network')
seed = 0

# Nodes and Ensembles
with net:
    a = nengo.Ensemble(50, dimensions=1, label='A', neuron_type=nengo.LIF())
    b = nengo.Ensemble(50, dimensions=1, label='B', neuron_type=nengo.LIF())

    cos = nengo.Node(lambda x: np.cos(8 * x))

# Connections
with net:
    nengo.Connection(cos, a)
    nengo.Connection(cos, b)
    nengo.Connection(a, a, synapse=0.1)
    nengo.Connection(b, b, synapse=0.1)
    conn = nengo.Connection(a, b)

# Probes
with net:
    probe_cos = nengo.Probe(cos)
    probe_spikes_a = nengo.Probe(a.neurons)
    probe_spikes_b = nengo.Probe(b.neurons)
    probe_out_a = nengo.Probe(a, synapse=0.01)
    probe_out_b = nengo.Probe(b, synapse=0.01)

# Simulate
with nengo_loihi.Simulator(net, seed=seed) as sim:

List of LoihiBlock objects created:

  • <Ensemble "A">
  • <Ensemble "B">
  • <Connection from <Ensemble "A"> to <Ensemble "A">>
  • <Connection from <Ensemble "B"> to <Ensemble "B">>
  • <Connection from <Ensemble "A"> to <Ensemble "B">>
  • <Connection from <Ensemble "A"> to <Probe of 'decoded_output' of <Ensemble "A">>>
  • <Connection from <Ensemble "B"> to <Probe of 'decoded_output' of <Ensemble "B">>>

Hi @wnourse,

Nengo Loihi’s default behavior is exactly what you suspected, each Block will be put on a separate core on the same chip. A Block only contains things that would be put on a neuron core; things running through snips or on the superhost are tracked elsewhere.

The place in the code where this happens is nengo_loihi/hardware/ The default OneToOne allocator puts each block onto a separate core on the same chip, so multiple chips are not accessible by default. There is also a RoundRobin allocator which is able to access multiple chips, but does so in a similar way as OneToOne accesses cores.

Ideally we will implement more sophisticated allocation schemes in the future, but it’s not currently something that we’re working on.