-
Notifications
You must be signed in to change notification settings - Fork 0
Windowed SCP for reads and writes #117
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
Conversation
Looks like this will be plagued by timeouts... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Default should be 1, should actually query the machine to determine what this value is.
**Supercedes #115** Uses sliding window protocol to increase speed for bursts of SCP messages. Talking to a locally connection SpiNN3 I'm hitting 20+ Mb/s for both writes and reads to (chip 0, 0). - [x] Neaten documentation - [x] Rework `send_scp` to send a burst of one message (mostly to reduce duplication of code) - [x] Fill in a few gaps in the tests. - [ ] Set the default window size to 1 - [ ] Correctly query the window size from SC&MP - [ ] Set the transient IPTag timeout correctly
3ebcdaf
to
e183fce
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Default mask can, I think, be safely 0xffff
(and should be).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unpack_from
would make sense here.
Further increases SCP performance on reads and writes by not unpacking SCP packets unless absolutely necessary.
With tonight's changes this is pushing nearer to 27+Mib/s on 10MiB reads and writes to a locally connected Spin3 board. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not good... (the padding bytes are already included in outstanding.packet
) and probably explains the frequent time outs. This is also a bug in the tests.
Previously the padding bytes were being included twice in retransmitted packets. This fixes that bug and introduces a test to ensure that retransmitted packets are transmitted exactly.
4d83ffd
to
f25c795
Compare
Cancelling running tests is a bad thing that I shouldn't do... |
Is it a bad thing? |
With the window size set to 1 this branch gets reads and writes at around 11-12Mbit/s against my local board (0, 0) and 5Mbit/s against (1, 1). (Master is at around 8-9Mbit/s and 4Mbit/s.) @mossblaser do we want to consider merging this now with the window size set to 1? We can investigate setting the TTO and reading the window size in an additional PR. |
Via a switch on my machine, window size = 1 I get:
Just upping the window now... |
..and with window size 8:
Very good! |
Yay C-like performance :) |
If you want a laugh... here's the C numbers:
...so you beat rig-scp ;) :P |
PyPy time :P |
I would say that seems like a good idea. Will have a look over the code as it stands first though :) |
Of course! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would a closure not be sufficient?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, because the received packet has to be stored somewhere.
In Python 3 I can do:
packet = None
def callback(received_bytes):
nonlocal packet
packet = ...
But not in Python 2.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't the format string at the start not imply the length here too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. Why? The constant is the offset.
Looks jolly good to me, though that excludes the busy loop(!) which should be an easy enough fix and drop the CPU loading down a fair bit. Plus would save a load of "get time" system calls (so actual performance may be ever-so-slightly improved... but that is a dubious claim ;)). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Noted by @mossblaser: this should be a while
Unused argument.
- Reduces the number of calls to create a bytestring - Implements @mossblaser suggestion of calling `iter` on `parameters_and_callbacks`.
I'm finding that select, and switching to using a |
Also, that 100% is not 100%... there's a branch missing in |
Interprets some error codes (RC_P2P_xxx) as if they were a timeout. With a modest window size this allows correct behaviour when talking to anything but an ethernet connected chip.
With the exception of |
This bizarrely introduces some overhead which, despite numerous attempts to track down its source, has not entirely been eliminated. That said, it does bring the CPU load *way* down. Strangely, this patch negatively impacts write performance slightly (for both 0,0 and 1,1) and read performance for 0,0 but positively impacts read performance for 1,1. Further experimentation is required...
@mossblaser, I've fixed a broken test. There are still failing tests for you to investigate.
@mossblaser, if I merge in your select work and get the tests to pass again can we consider merging this soon? |
- Mocks out "select" so that it will work with mocks. - Changes tests to deal with slight change in send/receive operation.
`min` doesn't have a keyword `default` earlier than Python 3.4, this removes the requirement and adds a test that tests the newly added branch works correctly.
That sounds like a plan :) thanks! Jonathan
|
Windowed SCP with `select`
I'm not sure what's up with Coveralls... coverage remains at 100% though. @mossblaser, are we happy with this? |
Yep I'm happy. Silly Coveralls... Merge and release at will! Sorry about the delay ;) |
Windowed SCP for reads and writes
Thanks |
Uses sliding window protocol to increase speed for bursts of SCP messages.
As of 14th May this results in reads and writes to chip (0, 0) of around 30+Mbit/s when using a window size of 8. When using a window size of 1 this drops to (a still respectable) 12ish Mbit/s on my test machine.
send_scp
to send a burst of one message (mostly toreduce duplication of code)
Correctly query the window size from SC&MPFor a later PRSet the transient IPTag timeout correctlyFor a later PR