Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RefPort's sometimes handled a time step late #205

Merged
merged 42 commits into from
Mar 2, 2022
Merged
Show file tree
Hide file tree
Changes from 41 commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
f456afb
- Initial enablement of RefPort and VarPorts
PhilippPlank Nov 12, 2021
2d0ec74
- Initial enablement of RefPort and VarPorts
PhilippPlank Nov 12, 2021
25a3a68
- Initial enablement of RefPort and VarPorts
PhilippPlank Nov 12, 2021
a2d1765
- Initial enablement of RefPort and VarPorts
PhilippPlank Nov 12, 2021
74dfdf6
Merge branch 'lava-nc:main' into main
PhilippPlank Nov 15, 2021
1daa9af
- Enablement of RefPorts and VarPorts - addressed change requests fro…
PhilippPlank Nov 16, 2021
5908401
- Enablement of RefPorts and VarPorts - addressed change requests fro…
PhilippPlank Nov 16, 2021
3df2847
- Enablement of RefPorts and VarPorts - addressed change requests fro…
PhilippPlank Nov 16, 2021
9581fae
Merge branch 'lava-nc:main' into main
PhilippPlank Nov 16, 2021
6e4716a
- Enablement of RefPorts and VarPorts - addressed change requests fro…
PhilippPlank Nov 16, 2021
e22def6
Merge branch 'lava-nc:main' into main
PhilippPlank Nov 17, 2021
bd25a80
Merge branch 'lava-nc:main' into main
PhilippPlank Nov 17, 2021
7edeb1f
Merge branch 'lava-nc:main' into main
PhilippPlank Nov 18, 2021
23fb8d7
Merge branch 'lava-nc:main' into main
PhilippPlank Nov 18, 2021
f6686b4
Merge branch 'lava-nc:main' into main
PhilippPlank Nov 23, 2021
86867c2
Merge branch 'lava-nc:main' into main
PhilippPlank Nov 23, 2021
859a195
Merge branch 'lava-nc:main' into main
PhilippPlank Nov 24, 2021
f7007f8
Merge branch 'lava-nc:main' into main
PhilippPlank Nov 25, 2021
0163202
Merge branch 'lava-nc:main' into main
PhilippPlank Nov 25, 2021
bf934ef
modified connection tutorial for release 0.2.0
PhilippPlank Nov 26, 2021
0eef67e
Merge branch 'lava-nc:main' into main
PhilippPlank Nov 26, 2021
f08a35c
fixed typos
PhilippPlank Nov 26, 2021
ceddf2a
Merge branch 'lava-nc:main' into main
PhilippPlank Nov 26, 2021
f798b0a
Merge branch 'lava-nc:main' into main
PhilippPlank Nov 30, 2021
b6e72bb
Merge branch 'lava-nc:main' into main
PhilippPlank Dec 1, 2021
9c57309
Merge branch 'lava-nc:main' into main
PhilippPlank Dec 3, 2021
7425f7e
Merge branch 'lava-nc:main' into main
PhilippPlank Dec 6, 2021
bc353c7
Merge branch 'lava-nc:main' into main
PhilippPlank Jan 27, 2022
73288a4
Merge branch 'lava-nc:main' into main
PhilippPlank Jan 31, 2022
3f5c2d7
Merge branch 'lava-nc:main' into main
PhilippPlank Feb 9, 2022
e691b1d
Merge branch 'lava-nc:main' into main
PhilippPlank Feb 10, 2022
9ab9a5d
Merge branch 'lava-nc:main' into main
PhilippPlank Feb 10, 2022
a1f0367
Merge branch 'lava-nc:main' into main
PhilippPlank Feb 16, 2022
50f9113
Merge branch 'lava-nc:main' into main
PhilippPlank Feb 16, 2022
e2342f5
Merge branch 'lava-nc:main' into main
PhilippPlank Feb 24, 2022
0b7cedb
Merge branch 'lava-nc:main' into main
PhilippPlank Feb 24, 2022
6a30ad7
Merge branch 'lava-nc:main' into main
PhilippPlank Feb 25, 2022
8e652bc
Merge branch 'lava-nc:main' into main
PhilippPlank Feb 25, 2022
26db3bd
- Introducing of a wait() method for RefPorts makes sure that sent da…
PhilippPlank Mar 1, 2022
660e64a
- optimized Reset by not using a read() to get the data shape
PhilippPlank Mar 2, 2022
33febd0
Merge branch 'main' into refport_wait
PhilippPlank Mar 2, 2022
60f9a83
- modified docstring of wait
PhilippPlank Mar 2, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 18 additions & 0 deletions src/lava/magma/core/model/py/ports.py
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,24 @@ def write(
"""
pass

# TODO: (PP) This should be optimized by a proper CSPSendPort wait
def wait(self):
"""Method which block execution until (all) previous write requests have
PhilippPlank marked this conversation as resolved.
Show resolved Hide resolved
PhilippPlank marked this conversation as resolved.
Show resolved Hide resolved
been placed at the receiver. Calling wait() ensures that the value
written by the RefPort can be received (and set) by the VarPort at the
same time step. If wait() is not called, it is possible that the value
is received only at the next time step (non-deterministic).

>>> port = PyRefPort()
>>> port.write(5)
>>> # potentially do other stuff
>>> port.wait() # waits until (all) previous writes have finished

Preliminary implementation. Currently, a simple read() ensures the
writes have been acknowledged. This is inefficient and will be
optimized later at the CspChannel level"""
self.read()

def _transform(self, recv_data: np.array) -> np.array:
"""Applies all transformation function pointers to the input data.

Expand Down
1 change: 1 addition & 0 deletions src/lava/proc/io/dataloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ def run_post_mgmt(self) -> None:
self.sample_id += 1
if self.sample_id == len(self.dataset):
self.sample_id = 0
self.state.wait() # ensures write() has finished before moving on


@implements(proc=StateDataloader, protocol=LoihiProtocol)
Expand Down
4 changes: 3 additions & 1 deletion src/lava/proc/io/reset.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ def post_guard(self) -> None:
return self.time_step % self.interval == self.offset

def run_post_mgmt(self) -> None:
self.state.write(0 * self.state.read() + self.reset_value)
self.state.write(np.zeros(self.state._shape,
self.state._d_type) + self.reset_value)
self.state.wait() # ensures write() has finished before moving on


@implements(proc=Reset, protocol=LoihiProtocol)
Expand Down