Skip to content

Commit

Permalink
fix linting
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilippPlank committed Jun 13, 2023
1 parent 2c6f58f commit 3ada1a8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
1 change: 1 addition & 0 deletions src/lava/magma/compiler/channels/pypychannel.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ def join(self):
self._ack = None
self._req = None


class CspRecvQueue(Queue):
"""
Underlying queue which backs the CspRecvPort
Expand Down
1 change: 1 addition & 0 deletions src/lava/proc/io/bridge/extractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ def __del__(self) -> None:
self._multi_processing.stop()
self._extractor_channel_dst_port.join()


@implements(proc=Extractor, protocol=LoihiProtocol)
@requires(CPU)
class PyLoihiExtractorModel(PyLoihiProcessModel):
Expand Down
16 changes: 9 additions & 7 deletions tests/lava/proc/io/test_injector.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@

from lava.magma.runtime.message_infrastructure.multiprocessing import \
MultiProcessing
from lava.magma.compiler.channels.pypychannel import PyPyChannel, CspRecvPort, \
CspSendPort
from lava.magma.compiler.channels.pypychannel import (PyPyChannel, CspRecvPort,
CspSendPort)

from lava.proc.io.bridge.injector import Injector, PyLoihiInjectorModel
from lava.proc.io.bridge.utils import ChannelConfig, ChannelSendBufferFull, \
Expand All @@ -50,6 +50,7 @@ def __init__(self,
self.var = Var(shape=(buffer_size, ) + shape, init=0)
self.in_port = InPort(shape=shape)


@implements(proc=Recv, protocol=LoihiProtocol)
@requires(CPU)
class PyRecvProcModel(PyLoihiProcessModel):
Expand All @@ -62,7 +63,8 @@ def __init__(self, proc_params: dict) -> None :
self._buffer_size = proc_params["buffer_size"]

def run_spk(self) -> None:
self.var[(self.time_step-1) % self._buffer_size] = self.in_port.recv()
self.var[
(self.time_step - 1) % self._buffer_size] = self.in_port.recv()


class TestInjector(unittest.TestCase):
Expand Down Expand Up @@ -249,8 +251,8 @@ def thread_2_fn(queue: Queue) -> None:
injector.send_data(np.ones(data_shape))
checkpoint_3 = time.perf_counter()

queue.put(checkpoint_2-checkpoint_1)
queue.put(checkpoint_3-checkpoint_2)
queue.put(checkpoint_2 - checkpoint_1)
queue.put(checkpoint_3 - checkpoint_2)

thread_2 = threading.Thread(target=thread_2_fn,
daemon=True,
Expand Down Expand Up @@ -584,5 +586,5 @@ def test_run_continuous(self):

injector.stop()

np.testing.assert_equal(recv_var_data[:num_send//10],
send_data[:num_send//10])
np.testing.assert_equal(recv_var_data[:num_send // 10],
send_data[:num_send // 10])

0 comments on commit 3ada1a8

Please sign in to comment.