Skip to content

Example: Calling External Solvers #49

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

Closed
finmod opened this issue Sep 12, 2016 · 21 comments
Closed

Example: Calling External Solvers #49

finmod opened this issue Sep 12, 2016 · 21 comments

Comments

@finmod
Copy link

finmod commented Sep 12, 2016

In the external solvers section,

sol =solve(prob::ODEProblem,tspan,Δt=Δt,alg=:ode45)
plot(sol,lab=["x" "y"])

LoadError: UndefVarError: ExplicitODE not defined
while loading In[4], in expression starting on line 1

in #solve#559(::Array{Any,1}, ::Function, ::DifferentialEquations.ODEProblem{Array{Float64,1},Float64}, ::Array{Int64,1}) at C:\Users\Denis.julia\v0.5\DifferentialEquations\src\ode\ode_solve.jl:256
in (::DifferentialEquations.#kw##solve)(::Array{Any,1}, ::DifferentialEquations.#solve, ::DifferentialEquations.ODEProblem{Array{Float64,1},Float64}, ::Array{Int64,1}) at .:0

then at

sol =solve(prob::ODEProblem,tspan,Δt=Δt,alg=:dopri5)
plot(sol,lab=["x" "y"])

[DifferentialEquations.jl] Initializing backend: ODEInterface
LoadError: Cannot find method(s) for dopri5! I've tried to loadODESolvers(), but it didn't work. Please check ODEInterface.help_solversupport() and call loadODESolvers and check also this output. For further information see also ODEInterface.help_install.

while loading In[5], in expression starting on line 1

in getAllMethodPtrs(::String) at C:\Users\Denis.julia\v0.5\ODEInterface\src.\DLSolvers.jl:229
in dopri5_impl(::Function, ::Float64, ::Float64, ::Array{Float64,1}, ::ODEInterface.OptionsODE, ::ODEInterface.DopriArguments{Int64}) at C:\Users\Denis.julia\v0.5\ODEInterface\src.\Dopri5.jl:128
in dopri5(::Function, ::Float64, ::Float64, ::Array{Float64,1}, ::ODEInterface.OptionsODE) at C:\Users\Denis.julia\v0.5\ODEInterface\src.\Dopri5.jl:102
in odecall(::ODEInterface.#dopri5, ::Function, ::Array{Float64,1}, ::Array{Float64,1}, ::ODEInterface.OptionsODE) at C:\Users\Denis.julia\v0.5\ODEInterface\src.\Call.jl:115
in #solve#559(::Array{Any,1}, ::Function, ::DifferentialEquations.ODEProblem{Array{Float64,1},Float64}, ::Array{Int64,1}) at C:\Users\Denis.julia\v0.5\DifferentialEquations\src\ode\ode_solve.jl:216
in (::DifferentialEquations.#kw##solve)(::Array{Any,1}, ::DifferentialEquations.#solve, ::DifferentialEquations.ODEProblem{Array{Float64,1},Float64}, ::Array{Int64,1}) at .:0

and again for the next two dopri5

Finally at

sol =solve(prob::ODEProblem,tspan,Δt=Δt,alg=:cvode_Adams)
plot(sol,lab=["x" "y"])

[DifferentialEquations.jl] Initializing backend: Sundials
LoadError: UndefVarError: cvode_fulloutput not defined
while loading In[8], in expression starting on line 1

in #solve#559(::Array{Any,1}, ::Function, ::DifferentialEquations.ODEProblem{Array{Float64,1},Float64}, ::Array{Int64,1}) at C:\Users\Denis.julia\v0.5\DifferentialEquations\src\ode\ode_solve.jl:317
in (::DifferentialEquations.#kw##solve)(::Array{Any,1}, ::DifferentialEquations.#solve, ::DifferentialEquations.ODEProblem{Array{Float64,1},Float64}, ::Array{Int64,1}) at .:0

@ChrisRackauckas
Copy link
Member

ChrisRackauckas commented Sep 12, 2016

Did you do the install from this page?

http://juliadiffeq.github.io/DifferentialEquations.jl/latest/man/conditional_dependencies.html

Most of the installs are not for the latest tag:

  • Sundials needs to be on master until the next tag.
  • ODE needs to use the JuliaODE branch (@pwl's iterator PR)
  • ODEInterface should work just fine on its master.

Did ODEInterface build for you? Try `Pkg.build("ODEInterface").

I realized that the links in the README broke when we moved to JuliaDiffEq, so I just pushed up a fix for that (you might need to refresh).

@finmod
Copy link
Author

finmod commented Sep 12, 2016

The answer is no for some of them. Should I remove the existing packages and install from

http://juliadiffeq.github.io/DifferentialEquations.jl/latest/man/conditional_dependencies.html http://juliadiffeq.github.io/DifferentialEquations.jl/latest/man/conditional_dependencies.html

What is the right sequence of commands to return to this point.

From: Christopher Rackauckas [mailto:[email protected]]
Sent: Monday, September 12, 2016 9:54 PM
To: JuliaDiffEq/DifferentialEquations.jl [email protected]
Cc: finmod [email protected]; Author [email protected]
Subject: Re: [JuliaDiffEq/DifferentialEquations.jl] Example: Calling External Solvers (#49)

Did you do the install from this page:?

http://juliadiffeq.github.io/DifferentialEquations.jl/latest/man/conditional_dependencies.html

Most of the installs are not for the latest tag:

  • Sundials needs to be on master until the next tag.
  • ODE needs to use the JuliaODE branch (@pwl https://github.com/pwl 's iterator PR)
  • ODEInterface should work just fine on its master.

Did ODEInterface build for you? Try `Pkg.build("ODEInterface").

I realized that the links in the README broke when we moved to JuliaDiffEq, so I just pushed up a fix for that (you might need to refresh).


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub #49 (comment) , or mute the thread https://github.com/notifications/unsubscribe-auth/AMHyIrYOlvKCS2Ogccnf3LXz0mYHpXw7ks5qpbv5gaJpZM4J7A8c . https://github.com/notifications/beacon/AMHyIrnibjN5-cXUGbCypw2jSaoT1e2dks5qpbv5gaJpZM4J7A8c.gif

@ChrisRackauckas
Copy link
Member

To get to the right branch for Sundials, you just need to do

Pkg.checkout("Sundials")

If you followed the previous instructions for using it pre-JuliaDiffEq/Sundials.jl#67, you will need to

Pkg.rm("Sundials")
Pkg.add("Sundials")
Pkg.checkout("Sundials")
Pkg.build("Sundials") #Maybe? It might build for you automatically

After SciML/Sundials.jl#75, Sundials will get a new minor tag and this will no longer be necessary.

For ODE.jl, you need to make sure you're on pwl's repo:

Pkg.rm("ODE")
Pkg.clone("https://github.com/JuliaODE/ODE.jl")

Notice that the command here is clone since Pkg.add will get the version from JuliaDiffEq which is not the work-in-progress branch that DifferentialEquations.jl is compatible with (this work-in-progress branch is set to replace the current ODE.jl sometime "soon")

ODEInterface should just work, though it might have building issues. If you run

using ODEInterface
loadODESolvers()

Do you get errors?

@finmod
Copy link
Author

finmod commented Sep 12, 2016

Sundials is now fine. Let get through the rest.

From: Christopher Rackauckas [mailto:[email protected]]
Sent: Monday, September 12, 2016 10:26 PM
To: JuliaDiffEq/DifferentialEquations.jl [email protected]
Cc: finmod [email protected]; Author [email protected]
Subject: Re: [JuliaDiffEq/DifferentialEquations.jl] Example: Calling External Solvers (#49)

To get to the right branch for Sundials, you just need to do

Pkg.checkout("Sundials")

If you followed the previous instructions for using it pre-JuliaDiffEq/Sundials.jl#67, you will need to

Pkg.rm("Sundials")
Pkg.add("Sundials")
Pkg.checkout("Sundials")
Pkg.build("Sundials") #Maybe? It might build for you automatically

After SciML/Sundials.jl#75 SciML/Sundials.jl#75 , Sundials will get a new minor tag and this will no longer be necessary.

For ODE.jl, you need to make sure you're on pwl's repo:

Pkg.rm("ODE")
Pkg.clone("https://github.com/JuliaODE/ODE.jl")

Notice that the command here is clone since Pkg.add will get the version from JuliaDiffEq which is not the work-in-progress branch that DifferentialEquations.jl is compatible with (this work-in-progress branch is set to replace the current ODE.jl sometime "soon")

ODEInterface should just work, though it might have building issues. If you run

using ODEInterface
loadODESolvers()

Do you get errors?


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub #49 (comment) , or mute the thread https://github.com/notifications/unsubscribe-auth/AMHyIqKaN1qwugmB_D-PFM1xJFwPnkr8ks5qpcNLgaJpZM4J7A8c . https://github.com/notifications/beacon/AMHyIgrzruaimtGIz38IlXXk8fWo6zN_ks5qpcNLgaJpZM4J7A8c.gif

@finmod
Copy link
Author

finmod commented Sep 12, 2016

For ODE, it says that the package already exists.

This is after: Pkg.rm(“ODE”)

For ODEInterface, nothing doing.

From: Christopher Rackauckas [mailto:[email protected]]
Sent: Monday, September 12, 2016 10:26 PM
To: JuliaDiffEq/DifferentialEquations.jl [email protected]
Cc: finmod [email protected]; Author [email protected]
Subject: Re: [JuliaDiffEq/DifferentialEquations.jl] Example: Calling External Solvers (#49)

To get to the right branch for Sundials, you just need to do

Pkg.checkout("Sundials")

If you followed the previous instructions for using it pre-JuliaDiffEq/Sundials.jl#67, you will need to

Pkg.rm("Sundials")
Pkg.add("Sundials")
Pkg.checkout("Sundials")
Pkg.build("Sundials") #Maybe? It might build for you automatically

After SciML/Sundials.jl#75 SciML/Sundials.jl#75 , Sundials will get a new minor tag and this will no longer be necessary.

For ODE.jl, you need to make sure you're on pwl's repo:

Pkg.rm("ODE")
Pkg.clone("https://github.com/JuliaODE/ODE.jl")

Notice that the command here is clone since Pkg.add will get the version from JuliaDiffEq which is not the work-in-progress branch that DifferentialEquations.jl is compatible with (this work-in-progress branch is set to replace the current ODE.jl sometime "soon")

ODEInterface should just work, though it might have building issues. If you run

using ODEInterface
loadODESolvers()

Do you get errors?


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub #49 (comment) , or mute the thread https://github.com/notifications/unsubscribe-auth/AMHyIqKaN1qwugmB_D-PFM1xJFwPnkr8ks5qpcNLgaJpZM4J7A8c . https://github.com/notifications/beacon/AMHyIgrzruaimtGIz38IlXXk8fWo6zN_ks5qpcNLgaJpZM4J7A8c.gif

@ChrisRackauckas
Copy link
Member

You may want to use the web interface when showing code / error messages. If you tried to put them there, they didn't show up.

It might be a little messy to install pwl's branch for ODE.jl. You may need to mess with your local METADATA. Personally, when I switched back and forth I just wiped the METADATA, though that's a nuclear option which requires you re-install your packages (good for testing, bad thing to tell users). You may be able to remove the ODE folder from METADAT (METADATA/ODE), and remove the compile cache ODE.ji, and then run Pkg.clone("https://github.com/JuliaODE/ODE.jl"). However, note that this will make your METADATA dirty, so it may not Pkg.update() anymore.

Maybe @mauro3 or @pwl knows of a better way to switch ODE between the different repos more seamlessly?

@ChrisRackauckas
Copy link
Member

For ODEInterface, restart from the beginning. It should be:

Pkg.rm("ODEInterface")
Pkg.add("ODEInterface")
Pkg.build("ODEInterface")
loadODESolvers()

If nothing errors there, then it should be working.

@finmod
Copy link
Author

finmod commented Sep 12, 2016

At Pkg.build(“ODEInterface”), it says that currently only gfrtran is supported.

Does not build.

From: Christopher Rackauckas [mailto:[email protected]]
Sent: Monday, September 12, 2016 11:16 PM
To: JuliaDiffEq/DifferentialEquations.jl [email protected]
Cc: finmod [email protected]; Author [email protected]
Subject: Re: [JuliaDiffEq/DifferentialEquations.jl] Example: Calling External Solvers (#49)

For ODEInterface, restart from the beginning. It should be:

Pkg.rm("ODEInterface")
Pkg.add("ODEInterface")
Pkg.build("ODEInterface")
loadODESolvers()

If nothing errors there, then it should be working.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub #49 (comment) , or mute the thread https://github.com/notifications/unsubscribe-auth/AMHyIs41o443hPS-oKtc1veT53nOgaNMks5qpc81gaJpZM4J7A8c . https://github.com/notifications/beacon/AMHyIholQGQRokAqpR7i-BAVRAF_rluXks5qpc81gaJpZM4J7A8c.gif

@ChrisRackauckas
Copy link
Member

Ahh, and you said you're on Windows? You might have the same path issue I had when I first tried it: luchr/ODEInterface.jl#2

If you are using Juno and added Julia to the path to do so, that can cause this issue.

@finmod
Copy link
Author

finmod commented Sep 12, 2016

So a fast resolution is to remove Juno with Pkg.rm(“Juno”) and then the series on ODEInterface again?

From: Christopher Rackauckas [mailto:[email protected]]
Sent: Monday, September 12, 2016 11:25 PM
To: JuliaDiffEq/DifferentialEquations.jl [email protected]
Cc: finmod [email protected]; Author [email protected]
Subject: Re: [JuliaDiffEq/DifferentialEquations.jl] Example: Calling External Solvers (#49)

Ahh, and you said you're on Windows? You might have the same path issue I had when I first tried it: luchr/ODEInterface.jl#2 luchr/ODEInterface.jl#2

If you are using Juno and added Julia to the path to do so, that can cause this issue.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub #49 (comment) , or mute the thread https://github.com/notifications/unsubscribe-auth/AMHyItO36CzUmLGlNBAm_ROPaLMO5rRZks5qpdFUgaJpZM4J7A8c . https://github.com/notifications/beacon/AMHyIi-DdcRee6ejB9k6G67yuBdW8MDiks5qpdFUgaJpZM4J7A8c.gif

@ChrisRackauckas
Copy link
Member

ChrisRackauckas commented Sep 12, 2016

No. You need to explicitly give Juno the path, like:

juno

Then you need to make sure Julia is not in your path, install mingw-64 from here, and add it to your path like here:

path

(the third path on the far right is where the mingw path is)

Then ODEInterface should build correctly on Windows if you're using Juno (this is one of the reasons why I am making native Julia versions of all of those, because this can be a nightmare to get right!)

@mauro3
Copy link

mauro3 commented Sep 13, 2016

The reason Pkg.rm("ODE") does not remove ODE is because other packages depend on it, see.

The way I switch is add a remote and checkout that. I don't think this can be done from the Julia REPL. In the shell cd to the directory of ODE.jl, (~/.julia/v0.5/ODE on my system):

git remote add JuliaODE https://github.com/JuliaODE/ODE.jl.git
git checkout JuliaODE/master

it will say something about a detached head, don't worry. To go back to the original:

git checkout origin/master

(I think) Edited according to Chris' comment

@ChrisRackauckas
Copy link
Member

Yeah, I feared there wasn't a pure Julia way to do it. What you're saying should work, though maybe it might need to be git checkout origin/master, and since master is used in both, if someone uses Github Desktop it will bug if you try to change between the two. So it's a little bit of a mess, but it'll fix itself when the PR is done and goes through.

@mauro3
Copy link

mauro3 commented Sep 13, 2016

I guess you could open a feature request issue:

Pkg.checkout(pkg, [branch="master"]; merge=true, pull=true, remote=origin)

But probably it's fine to just leave that. For trickier git-stuff it's easier to just git-it.

@ChrisRackauckas
Copy link
Member

Yeah, I don't know if it's necessary since at the point where you want to specify the remote, you will have had to add the remote with Git anyways, so you probably know git (or are just following someone's instructions line by line which could just be terminal commands)

@finmod
Copy link
Author

finmod commented Sep 13, 2016

I am still struggling with this. Can you pls confirm the end of path for the environment variable. I cannot read your full link. Mine is:

C:\Program Files\mingw-w64\x86_64-6.2.0-posix-seh-rt_v5-rev1\mingw64\bin for now.

Also can you indicate the content of your juliarc.jl.

Atome is working, Juno is installed, the Julia path has been modified as per your instructions.

For now, my Julia launcher on the taskbar no longer launches Julia.

Thanks

From: Christopher Rackauckas [mailto:[email protected]]
Sent: Monday, September 12, 2016 11:44 PM
To: JuliaDiffEq/DifferentialEquations.jl [email protected]
Cc: finmod [email protected]; Author [email protected]
Subject: Re: [JuliaDiffEq/DifferentialEquations.jl] Example: Calling External Solvers (#49)

No. You need to explicitly give Juno the path, like:

https://cloud.githubusercontent.com/assets/1814174/18455537/65d323e8-78ff-11e6-961f-92294fbf9b11.PNG

Then you need to make sure Julia is not in your path, install mingw-64 from here https://sourceforge.net/projects/mingw-w64/ , and add it to your path like here:

https://cloud.githubusercontent.com/assets/1814174/18455571/aa28edb6-78ff-11e6-9172-58d4e5b4297b.PNG

Then ODEInterface should build correctly on Windows if you're using Juno (this is one of the reasons why I am making native Julia versions of all of those, because this can be a nightmare to get right!)


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub #49 (comment) , or mute the thread https://github.com/notifications/unsubscribe-auth/AMHyIu9adJCsR2UtDww4RrmtUpXRIuzfks5qpdW8gaJpZM4J7A8c . https://github.com/notifications/beacon/AMHyIkXKdhnZMjG4aGJ5u2aQhGrH8jLrks5qpdW8gaJpZM4J7A8c.gif

@ChrisRackauckas
Copy link
Member

If you do the standard mingw install linked above and use the path

C:\Program Files\mingw-w64\x86_64-6.1.0-posix-seh-rt_v5-rev0\mingw64\bin

then Pkg.build("ODEInterface") should work.

(This problem with building it is one of the reasons why I am really gunning for making Julia-native versions of its solvers right now, though its stiff solvers (Radau and when it gets LSODE) will be tough competition for some time)

@finmod
Copy link
Author

finmod commented Sep 14, 2016

Eureka! I can now see the light at the end of the tunnel.

I think that you should set up the sequence of steps to get ODEInterface running in your README file.

Basically, I threw everything away then:

Download and install the latest Julia;

Download and install Atom for Windows;

Download and install mingw-64 as indicated earlier;

In Atom, changed the path as you indicated earlier after installing Julia and Juno;

Modified the environment variables adding the mingw-64 path as indicated below;

Pkg.add(“”) all that is required as per your instructions. Please note that Nemo is still building cleanly. All other packages eventually build by doing Pkg.add, Pkg.checkout and Pkg.build several times if necessary.

For ODEInterface, restart from the beginning. It should be:

Pkg.rm("ODEInterface")

Pkg.add("ODEInterface")

Pkg.build("ODEInterface")

loadODESolvers()

Finally, Linear Work Precision Diagrams is working for all steps.

We can start talking about DifferentialEquations…….

From: Christopher Rackauckas [mailto:[email protected]]
Sent: Tuesday, September 13, 2016 6:30 PM
To: JuliaDiffEq/DifferentialEquations.jl [email protected]
Cc: finmod [email protected]; Author [email protected]
Subject: Re: [JuliaDiffEq/DifferentialEquations.jl] Example: Calling External Solvers (#49)

If you do the standard mingw install linked above and use the path

C:\Program Files\mingw-w64\x86_64-6.1.0-posix-seh-rt_v5-rev0\mingw64\bin

then Pkg.build("ODEInterface") should work.

(This problem with building it is one of the reasons why I am really gunning for making Julia-native versions of its solvers right now, though its stiff solvers (Radau and when it gets LSODE) will be tough competition for some time)


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub #49 (comment) , or mute the thread https://github.com/notifications/unsubscribe-auth/AMHyIk_c2YmlYQwdD33Ja1DA2Rns_P3yks5qpt2ngaJpZM4J7A8c . https://github.com/notifications/beacon/AMHyItFqOl-9FFg8mElzp8H3I1y97Kauks5qpt2ngaJpZM4J7A8c.gif

@ChrisRackauckas
Copy link
Member

ChrisRackauckas commented Sep 14, 2016

Yeah, maybe I should post that somewhere (or maybe since I detailed that in this issue, that's good enough now). Technically it's not a DifferentialEquations.jl problem, but a "building ODEInterface.jl on Windows when you also have Juno installed" problem. Sundials and ODE will work out of the box once they tag new versions (/ the iterator PR SciML/ODE.jl#49 goes through), but I don't know how to hide the fact that getting Fortran compilers on Windows to work correctly is a black art.

But if you don't have Juno installed, ODEInterface should just work out of the box.

@ChrisRackauckas
Copy link
Member

Should this issue be closed / are there any problems left here?

@finmod
Copy link
Author

finmod commented Sep 14, 2016

Close #49

From: Christopher Rackauckas [mailto:[email protected]]
Sent: Wednesday, September 14, 2016 4:52 PM
To: JuliaDiffEq/DifferentialEquations.jl [email protected]
Cc: finmod [email protected]; Author [email protected]
Subject: Re: [JuliaDiffEq/DifferentialEquations.jl] Example: Calling External Solvers (#49)

Should this issue be closed / are there any problems left here?


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub #49 (comment) , or mute the thread https://github.com/notifications/unsubscribe-auth/AMHyIlQXr3EkjAuNepy7mUpNDEKIAI3Cks5qqBgygaJpZM4J7A8c . https://github.com/notifications/beacon/AMHyInsy4sEbjNr_redvQ0fQSl6USPVOks5qqBgygaJpZM4J7A8c.gif

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

No branches or pull requests

3 participants