-
Notifications
You must be signed in to change notification settings - Fork 217
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
Don't use group names in runtime code #680
Comments
I'd rather not make the link between the names in the simulation and the names in the code less clear if we can avoid it. Do you really think this is a problem in practice? If you run a simulation in a for loop, then you should only end up with two different sets of names, regardless of the total number of iterations (the second set of names because at construction time, the old objects still exist). Will this be noticeable in any real setting? The only situation where I can image that it somewhat matters would be in a jupyter notebook or a similar interactive setting.
We don't freeze constants in runtime (we do in standalone, though) -- are you sure you are not getting the recompilations due to the changed names? |
Do we reuse old but now deactivated Another solution: we can add a warning to the user if they are getting potentially unnecessary recompilations by taking the code string X and removing all names |
We definitely reuse previous names (see #216), but it is a bit worse than what I said. You'll actually get N+1 different combinations of names, where N is the number of objects of the same type. If you have code like this: for foo in bar:
group_1 = NeuronGroup(10, '')
group_2 = NeuronGroup(10, '')
run(0*ms) Then in the first run you'll get Actually, since we already have |
I have an intermediate suggestion if you don't like the name mapping one earlier. We talked about having a 'debug' mode (can't find the issue where we discussed this), which might include things like bounds checking on all array accesses, etc. We could make it so that if this debug mode is on (off by default) then it would use the original names, otherwise it would use the mapped names as above that avoided recompilation. |
If we can avoid using names of groups in generated code then we can avoid some recompilations that are currently happening. We could, for example, if there were two groups with names
neurongroup_3
andneurongroup_4
map_array_neurongroup_3
to_array_NeuronGroup1
and_array_neurongroup_4
to_array_NeuronGroup2
(i.e. we would look up the class name of the object pointed to, and give them a numerical index that increases from 1). Now if we ran again but it wouldneurongroup_5
andneurongroup_6
then it would still map to the same_array_NeuronGroup1
etc. and a recompilation wouldn't be necessary.I think we're already not freezing constants right? #480 suggests this, but on the other hand when I run some code with an increasing number of neurons
N
I seem to be getting recompilations sometimes. I think it would be good to avoid this for people running parameter space searches.The text was updated successfully, but these errors were encountered: