I'm trying to switch from Vode to Radau or Dopri integrator for my new model. But always get an error
Error in importing compiled vector field and integrator. Did you compile the RHS C code?
Here're details:
Traceback (most recent call last):
File "testpydstool/test1.py", line 223, in <module>
testModel.compute(trajname='test', tdata=[0,10], ics=ics, verboselevel=1)
File "anaconda/lib/python2.7/site-packages/PyDSTool/Model.py", line 2750, in compute
MI, swRules)
File "anaconda/lib/python2.7/site-packages/PyDSTool/Model.py", line 2282, in _findTrajInitiator
self.verboselevel)
File "anaconda/lib/python2.7/site-packages/PyDSTool/Model.py", line 3271, in findTrajInitiator
dxdt = dict(MI.Rhs(t, icdict, pardict))
File "anaconda/lib/python2.7/site-packages/PyDSTool/ModelContext.py", line 922, in Rhs
return self.model.Rhs(t, xdict, pdict)
File "anaconda/lib/python2.7/site-packages/PyDSTool/Model.py", line 1723, in Rhs
ds.Rhs(t, x_fs, pdict))),
File "anaconda/lib/python2.7/site-packages/PyDSTool/Generator/Radau_ODEsystem.py", line 981, in Rhs
Error in importing compiled vector field and integrator.
Did you compile the RHS C code?
self._ensure_solver({'params': p, 't0': 0, 'tend': 1})
File "anaconda/lib/python2.7/site-packages/PyDSTool/Generator/Radau_ODEsystem.py", line 1080, in _ensure_solver
extraSpace=self.algparams['extraspace'])
File "anaconda/lib/python2.7/site-packages/PyDSTool/Generator/Radau_ODEsystem.py", line 36, in __init__
self._integMod = __import__(modname, globals())
File "testpydstool/radau5_flight_vf.py", line 28, in <module>
_radau5_flight_vf = swig_import_helper()
File "ownCloud/model/testpydstool/radau5_flight_vf.py", line 24, in swig_import_helper
_mod = imp.load_module('_radau5_flight_vf', fp, pathname, description)
ImportError: dlopen(testpydstool/_radau5_flight_vf.so, 2): Symbol not found: _calzhip
Referenced from: testpydstool/_radau5_flight_vf.so
Expected in: dynamic lookup
Process finished with exit code 1
But I've tested some sample codes with Radau and Dopri, they worked fine. Does anyone know how to solve this problem?
Thanks in advance.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Then duplicate 'fnspecs' key with 'calzhip' definition in dict, which function 'getFlightArgs' returns. Like it's done for 'zeta' function in SLIP_2D.py.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
It looks like getFlightArgs does not return a dict entry for fnspecs that also contains the definition of calzhip. The fnspecs for the event definition is just to help out the event code in knowing what the constituent parts of the definition mean: they don't actually define anything.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The User Documentation points to several other pages to read, which cover this. The FuncSpec page, Sections 3 and 5, describes the dictionary for defining auxiliary functions. I have added some more explicit text to reinforce the idea that the fnspecs entry in the Generator creation arguments must be added for this to work.
The description of the fnspecs dictionary for events is given here, Section 2.
The second tutorial and other examples and tutorials show how aux functions are declared.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi all,
I'm trying to switch from Vode to Radau or Dopri integrator for my new model. But always get an error
Here're details:
But I've tested some sample codes with Radau and Dopri, they worked fine. Does anyone know how to solve this problem?
Thanks in advance.
What's in "radau5_temp/build.log" file?
Is 'calzhip' defined somewhere?
Yes, 'calzhip' is a function defined in both events and sub-model args. There's no error if I change the integrator to vode.
Here's "radau5_temp/build.log" file:
Last edit: Guoping Zhao 2015-04-28
Is there the definition of 'calzhip' function in generated VF file "radau5_temp/flight_vf.c"?
Show us, how you define 'calzhip' in your code.
Hmm, 'calzhip' function is not generated in the file "radau5_temp/flight_vf.c".
I think here's the part which is related to 'calzhip' and 'flight_vf':
There'll be no error if I remove the function 'calzhip' in event definition. That is:
But why?
Possibly bug, but not sure about support for using functions in C events.
Maybe Robert will be able to shed some light on this.
It should support. I saw it in the sample script SLIP_2D.py. My other codes also have functions in C event and work fine.
Maybe it's a bug.
Thanks a lot for your help.
Last edit: Guoping Zhao 2015-04-28
Then duplicate 'fnspecs' key with 'calzhip' definition in dict, which function 'getFlightArgs' returns. Like it's done for 'zeta' function in SLIP_2D.py.
Yes, you're right. I duplicate that and no errors anymore.
Thanks.
It looks like
getFlightArgs
does not return a dict entry forfnspecs
that also contains the definition ofcalzhip
. Thefnspecs
for the event definition is just to help out the event code in knowing what the constituent parts of the definition mean: they don't actually define anything.Ah, I see. Thank you.
Do you know where I can find this kind of information? I didn't find it on your tutorial webpages: http://www.ni.gsu.edu/~rclewley/PyDSTool/Tutorial.html
The User Documentation points to several other pages to read, which cover this. The FuncSpec page, Sections 3 and 5, describes the dictionary for defining auxiliary functions. I have added some more explicit text to reinforce the idea that the
fnspecs
entry in the Generator creation arguments must be added for this to work.The description of the
fnspecs
dictionary for events is givenhere, Section 2.
The second tutorial and other examples and tutorials show how aux functions are declared.
Thanks. It's very helpful.
I'm not sure how it's possible for that code to run with Vode. It would be helpful if you just privately emailed me your whole script.
OK, email sent. Thanks.