-
Notifications
You must be signed in to change notification settings - Fork 12
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
Speeding up snips by communicating less often #26
base: main
Are you sure you want to change the base?
Changes from 1 commit
eaebf8e
cfe42bc
d14606b
ea5482b
da7be19
8c23740
e77a8dc
03a6d42
a9eff59
ab549fe
d4e0a15
d89dfa3
b598de6
a2cac8a
68303cc
5380800
a71e353
e64de2e
688f8c0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,9 +42,9 @@ void nengo_io(runState *s) { | |
printf("initializing\n"); | ||
for (int i=0; i<N_INPUTS; i++) { | ||
readChannel(inChannel, spike, 3); | ||
s->userData[IDX_SPIKE_TARGETS+(i*3)+0] = spike[0]; | ||
s->userData[IDX_SPIKE_TARGETS+(i*3)+1] = spike[1]; | ||
s->userData[IDX_SPIKE_TARGETS+(i*3)+2] = spike[2]; | ||
s->userData[IDX_SPIKE_TARGETS+(i*3)+0] = spike[0]; // core id | ||
s->userData[IDX_SPIKE_TARGETS+(i*3)+1] = spike[1]; // pos axon | ||
s->userData[IDX_SPIKE_TARGETS+(i*3)+2] = spike[2]; // neg axon | ||
printf(" spike target %d: (%d %d %d)\n", | ||
i, spike[0], spike[1], spike[2]); | ||
} | ||
|
@@ -58,11 +58,15 @@ void nengo_io(runState *s) { | |
// printf("count %d\n", count[0]); | ||
|
||
// --- read input values (once every IO_STEPS) | ||
if (s->time % IO_STEPS == 0) { | ||
// Note that we do this at the *start* of an IO_STEP period (since | ||
// s->time starts at 1), so that we don't have a period at the beginning | ||
// of the simulation where we are ignoring the input. | ||
if (s->time % IO_STEPS == 1 % IO_STEPS) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this the same as There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, I didn't even notice I'd solved that puzzle before.... :) Yes, those are meant to be the same, and I agree that the explicit OR is clearer than the elegant mod-comparison thing. :) I've switched it to the explicit approach. |
||
for (int i=0; i < N_INPUTS; i++) { | ||
readChannel(inChannel, spike, 1); | ||
//printf(" %d: stim value %d.%d\n", s->time, i, spike[0]); | ||
value[i] = spike[0]; | ||
value[i] = spike[0]; // discretized version of the real value | ||
// to be used as input | ||
} | ||
|
||
// Communicate with learning snip | ||
|
@@ -106,13 +110,15 @@ void nengo_io(runState *s) { | |
} | ||
} | ||
|
||
// --- write output values (once every IO_STEPS) | ||
if ((IO_STEPS==1) || (s->time % IO_STEPS == 1)) { | ||
output[0] = s->time; | ||
if (N_OUTPUTS > 0) { | ||
// --- write output values (once every IO_STEPS) | ||
if ((IO_STEPS==1) || (s->time % IO_STEPS == 1)) { | ||
output[0] = s->time; | ||
{% for n_out, core, cx in probes %} | ||
output[{{ n_out }}] = core{{ core }}->cx_state[{{ cx }}].V; | ||
output[{{ n_out }}] = core{{ core }}->cx_state[{{ cx }}].V; | ||
{% endfor %} | ||
|
||
writeChannel(outChannel, output, N_OUTPUTS); | ||
writeChannel(outChannel, output, N_OUTPUTS); | ||
} | ||
} | ||
} |
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 the chip ID, right? Maybe put a "chip_id must be zero" message with the assertion.
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.
Comment added :)