brian2genn
brian2genn copied to clipboard
Undeclared Identifier Error for Multiple Runs
Hey there! I was running my first code on Brian2Genn, and I was trying to run the code multiple times on the same Jupyter Notebook File. It seems as though the code is looking for objects in the previous run, as it sometimes gives no error and plots a graph and other times gives the undeclared identifier error. I was wondering if I was using the device.activate() and device.reinit() methods properly, or if there is something else that I am missing.
from brian2 import * import brian2genn
%matplotlib inline
set_device('genn')
device.reinit() device.activate()
start_scope()
G = NeuronGroup(1, 'v : 1', threshold='v>0.6', reset='v=0', method='exact') G.v = '0.6' SM = StateMonitor(G, 'v', record=True) print("Completed without Errors")
run(100*ms) print("Ran without Errors")
plot(SM.t/ms, SM.v[0])
device.reinit() device.activate()
ERROR PROVIDED: neurongroup_group_variable_set_conditional_codeobject.cpp C:\Users\ademi\GeNNworkspace\brianlib\common_math.h(8,1): warning C4005: 'INFINITY': macro redefinition [C:\Users\ademi\GeNNworkspace\project.vcxproj] C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\ucrt\corecrt_math.h(88): message : see previous definition of 'INFINITY' [C:\Users\ademi\GeNNworkspace\project.vcxproj] C:\Users\ademi\GeNNworkspace\brianlib\common_math.h(9,1): warning C4005: 'NAN': macro redefinition [C:\Users\ademi\GeNNworkspace\project.vcxproj] C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\ucrt\corecrt_math.h(92): message : see previous definition of 'NAN' [C:\Users\ademi\GeNNworkspace\project.vcxproj] statemonitor_codeobject.cpp C:\Users\ademi\GeNNworkspace\brianlib\common_math.h(8,1): warning C4005: 'INFINITY': macro redefinition [C:\Users\ademi\GeNNworkspace\project.vcxproj] C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\ucrt\corecrt_math.h(88): message : see previous definition of 'INFINITY' [C:\Users\ademi\GeNNworkspace\project.vcxproj] C:\Users\ademi\GeNNworkspace\brianlib\common_math.h(9,1): warning C4005: 'NAN': macro redefinition [C:\Users\ademi\GeNNworkspace\project.vcxproj] C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\ucrt\corecrt_math.h(92): message : see previous definition of 'NAN' [C:\Users\ademi\GeNNworkspace\project.vcxproj] main.cpp C:\Users\ademi\GeNNworkspace\engine.cpp(45,19): error C2065: 'vneurongroup': undeclared identifier [C:\Users\ademi\GeNNworkspace\project.vcxproj] C:\Users\ademi\GeNNworkspace\engine.cpp(51,7): error C3861: 'pullneurongroupStateFromDevice': identifier not found [C:\Users\ademi\GeNNworkspace\project.vcxproj] C:\Users\ademi\GeNNworkspace\main.cpp(73,47): error C2065: 'ineurongroup': undeclared identifier [C:\Users\ademi\GeNNworkspace\project.vcxproj] C:\Users\ademi\GeNNworkspace\main.cpp(74,47): error C2065: 'vneurongroup': undeclared identifier [C:\Users\ademi\GeNNworkspace\project.vcxproj] C:\Users\ademi\GeNNworkspace\main.cpp(106,15): error C2065: 'ineurongroup': undeclared identifier [C:\Users\ademi\GeNNworkspace\project.vcxproj] C:\Users\ademi\GeNNworkspace\main.cpp(107,15): error C2065: 'vneurongroup': undeclared identifier [C:\Users\ademi\GeNNworkspace\project.vcxproj]
Hum ... I tried to reproduce the problem but it doesn't occur for me. Any ideas @mstimberg ?
Besides, you would only need one call to device.reinit()
at the end of this code snippet and no calls to device.activate
as the set_device function on top takes care of activation.
I called device.reinit() only once and did not call device.activate() in my new code, and it continues to provide the same error. Could the difference in results be due to different GPUs being used?
It is unlikely that a different GPU would make a difference here. However, from your posted output I can see you are working on Windows (whereas I am on a Mac).
Could you locate and upload the content of
C:\Users\ademi\GeNNworkspace\magicnetwork_model_CODE\
after one of the unsuccessful runs?
I will be away next week, and @mstimberg seems busy - so I'll pull in @neworderofjamie for any thoughts on this?
Hi @ademirtas04, @tnowotny is off this week but I'm back (that's August for you...) - are you still have problems with this?
Hi @neworderofjamie! Yep. I'm still having problems with it.
Good to know - in that case, could you upload the contents of the folder @tnowotny said?