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

Clarify the use of the "constant" attribute. #132

Merged
merged 1 commit into from
Oct 1, 2013

Conversation

mstimberg
Copy link
Member

If a Variable object is set to constant, this is now meant to have the intuitive meaning: The values stored do not change during a run (a code generation target could use this for optimizations). Only AttributeVariable objects that are non-constant are updated in the namespace at every timestep (and this will be probably removed in the long term, the only current use case is the t of the clock and this may well be handled with a specific solution). There's a new attribute constant_size for DynamicArrayVariable, stating whether the size of the array can change during a run (e.g. in monitors), this is necessary to update the reference to the underlying array.

There's still one inefficiency here: The reference to the underlying array is never actually used in the case of monitors, so we wouldn't necessarily need to update the reference. I think -- as we discussed earlier -- we should probably make clear for code whether it only reads from dynamic arrays (e.g. synaptic updates) or only writes to them (e.g. monitors).

Ready to merge from my side for this smallish change, only in case travis does not disagree of course ;)

If a Variable object is set to constant, this is now meant to have the intuitive meaning: The values stored do not change during a run (a code generation target could use this for optimizations). Only AttributeVariable objects that are non-constant are updated in the namespace at every timestep. There's a new attribute "constant_size" for DynamicArrayVariable, stating whether the size of the array can change during a run (e.g. in monitors), this is necessary to update the reference to the underlying array.
@coveralls
Copy link

Coverage Status

Coverage remained the same when pulling a4828b8 on constant_attribute into 68d5be3 on master.

thesamovar added a commit that referenced this pull request Oct 1, 2013
Clarify the use of the "constant" attribute.
@thesamovar thesamovar merged commit 9429991 into master Oct 1, 2013
@thesamovar thesamovar deleted the constant_attribute branch October 1, 2013 18:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants