Skip to content

Commit

Permalink
fixup! Use proper queue in HostReceiveNode for speed
Browse files Browse the repository at this point in the history
  • Loading branch information
hunse committed Nov 13, 2019
1 parent 376f4df commit a5a06f1
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions nengo_loihi/builder/inputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,13 @@ def update(self, t):
if len(self.queue) == 0: # will happen if host updates before chip
return np.zeros(self.size_out)

t1, x = self.queue.popleft()
assert t1 >= t, "Must retreive chip->host messages in order"
return x
t0, x0 = self.queue[0]
if abs(t - t0) < 1e-8:
self.queue.popleft()
return x0
else:
assert t < t0, "Must retrieve chip->host messages in order"
return np.zeros(self.size_out)

def receive(self, t, x):
# we assume that x will not be mutated (i.e. we do not need to copy)
Expand Down

0 comments on commit a5a06f1

Please sign in to comment.