SciML / DiffEqOnlineServer

Backend for DiffEqOnline, a webapp for scientific machine learning (SciML)
http://app.sciml.org/
Other
25 stars 11 forks source link

Docker image is comically large #3

Closed amellnik closed 7 years ago

amellnik commented 7 years ago

We end up using a ton of julia packages at the moment which require a build the first time around. All of these build artifacts end up in the docker image, and I should figure out how to not have that happen...

ChrisRackauckas commented 7 years ago

It shouldn't be using DifferentialEquations.jl directly, just OrdinaryDiffEq.jl, DiffEqBase.jl, and ParameterizedFunctions.jl. That should drop the number of dependencies immensely. And DifferentialEquations.jl is huge because of Git history... https://github.com/JuliaDiffEq/DifferentialEquations.jl/issues/107

amellnik commented 7 years ago

I'm getting an error with that package set:

LoadError: MethodError: no method matching solve(::DiffEqBase.ODEProblem{Array{Float64,1},Float64,true,ParameterizedFunctions.begin
dx = a*x - b*x*y
dy = -c*y + d*x*y
end

when running test.jl. Do I need to manually import it or something?

ChrisRackauckas commented 7 years ago

You need to give it an algorithm. The default algorithm handling is done in DifferentialEquations.jl (since it's the only package which depends on all of the solvers). We can just set the website to open with Tsit5().

amellnik commented 7 years ago

I've got the dropdown that selects the algorithm on the website, but I'm not currently passing it. Could you make a version of tests.jl that does the solving starting using a string containing "Tsit5" (or just send me a snippet)? I'll then modify the actual server (which I'm in the process of rewriting without JuliaWebAPI).

Edit: In the future, I'll keep all the server-related files in the main API and just have the Dockerfile fetch them, but I haven't gotten around to it yet.

ChrisRackauckas commented 7 years ago

I updated the test script to show how to do it. I went with the implementation of having a dictionary algs which holds all of the algorithms. The other option would require calling a function at runtime using the symbol, so I think that requires eval. But this option is very good: you could use this same list to populate the shown algorithms on the site using keys(algs) (maybe const algs). I think it's better to give a short curated list like this. If the list could have a description somewhere that would be cool too.

amellnik commented 7 years ago

I think I'm still missing something:

PS C:\Users\Alex\Documents\DiffEqOnlineServer> julia test.jl
WARNING: Method definition warn(Any...) in module Base at util.jl:350 overwritten in module Logging at C:\Users\Alex\.ju
lia\v0.5\Logging\src\Logging.jl:115.
WARNING: Method definition info(Any...) in module Base at util.jl:320 overwritten in module Logging at C:\Users\Alex\.ju
lia\v0.5\Logging\src\Logging.jl:115.
ERROR: LoadError: error compiling #ode_def_opts#1: error compiling symbolize: error compiling symbols: error compiling _
symbol: could not load library "symengine"
The specified module could not be found.

 in ode_def_opts(::Symbol, ::Dict{Symbol,Bool}, ::Expr, ::Expr, ::Vararg{Expr,N}) at C:\Users\Alex\.julia\v0.5\Parameter
izedFunctions\src\ode_def_opts.jl:5
 in include_from_node1(::String) at .\loading.jl:488
 in process_options(::Base.JLOptions) at .\client.jl:262
 in _start() at .\client.jl:318
while loading C:\Users\Alex\Documents\DiffEqOnlineServer\test.jl, in expression starting on line 29

Edit: it works from the docker host, just not on my windows system.

ChrisRackauckas commented 7 years ago

(Could you try on your Windows system using SymEngine, and if it doesn't work, report it to SymEngine.jl)

amellnik commented 7 years ago

I rebuilt it and now it works -- sorry for the confusion. Still messing around with Mux, trying to figure out if I can get it to work.

amellnik commented 7 years ago

Down to 412 MB now, seems OK for the moment.

ChrisRackauckas commented 7 years ago

I can siphon off the SymEngine parts of ParameterizedFunctions.jl to a separate package if needed. That would get rid of 141 MB for the repo, and about 400 MB more for Conda. It must be less on Linux because it's about 500MB just for that on my setup.

Do you think this would be well worth the effort?

amellnik commented 7 years ago

I don't think we need it for this - the hosting options I'm looking at now don't have a size limit.

(Please excuse brevity and errors, sent from a mobile device.)

On Jan 8, 2017 11:25 PM, "Christopher Rackauckas" notifications@github.com wrote:

I can siphon off the SymEngine parts of ParameterizedFunctions.jl to a separate package if needed. That would get rid of 141 MB for the repo, and about 400 MB more for Conda. It must be less on Linux because it's about 500MB just for that on my setup.

Do you think this would be well worth the effort?

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/JuliaDiffEq/DiffEqOnlineServer/issues/3#issuecomment-271223455, or mute the thread https://github.com/notifications/unsubscribe-auth/AGzU_oFgcS0hE3JCA6yv1b_j7UgkLJcIks5rQeDXgaJpZM4Ldk7u .

ChrisRackauckas commented 7 years ago

Talking with @isuruf it sounds like you can just Pkg.rm("Conda") after SymEngine.jl is installed. That should get rid of most of the memory and it isn't needed for anything else.

amellnik commented 7 years ago

Great, will do. I thought https://github.com/symengine/SymEngine.jl/pull/63 might mean that I didn't need conda, but I now realize that's just windows.