Skip to content

Pruning dependencies #135

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
wants to merge 5 commits into from
Closed

Pruning dependencies #135

wants to merge 5 commits into from

Conversation

kaandocal
Copy link
Contributor

I've noticed that GalacticOptim takes ages to load after precompilation for me (more than a minute), which is not good news for an interface package. Part of this is the dependency on many packages which do not appear essential on a first glance:

  • DiffEqBase: The relevant functionality seems to be NoAD and NullParameters which are now in SciML
  • ModelingToolkit: I didn't find any code that uses this (maybe a test dependency?)
  • Optim & Flux: Why not use @require as with the other packages? Flux in particular is a heavy package and introduces a lot of dependencies.

This PR removes DiffEqBase, marks ModelingToolkit as a test dependency and downgrades Optim and Flux to @require status. Loading GalacticOptim now takes half a minute, and most of that is due to the various differentiation packages. I propose demoting all of these to @require status (except DiffResults) so that users wishing to use GalacticOptim with eg. ForwardDiff only do not need to load 4 other packages.

Note: This version of the package does not @reexport Optim or Flux. Since this package is still in active development I hope this API breakage is acceptable.

Note 2: Since Flux does not yet have an abstract optimiser type (see here) I used a Union for now, but this is a compatibility issue.

Flux.Optimiser}


function __solve(prob::OptimizationProblem, opt, data = DEFAULT_DATA;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
function __solve(prob::OptimizationProblem, opt, data = DEFAULT_DATA;
function __solve(prob::OptimizationProblem, opt::AbstractFluxOptimiser , data = DEFAULT_DATA;

Copy link
Member

@ChrisRackauckas ChrisRackauckas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, can you version bump to 2.0?

@Vaibhavdixit02
Copy link
Member

I propose demoting all of these to @require status (except DiffResults) so that users wishing to use GalacticOptim with eg. ForwardDiff only do not need to load 4 other packages.

Yeah change that as well.

@ChrisRackauckas
Copy link
Member

Looks like this needs more test usings

@codecov
Copy link

codecov bot commented May 28, 2021

Codecov Report

Merging #135 (63d2a90) into master (65af75c) will decrease coverage by 25.16%.
The diff coverage is 62.07%.

Impacted file tree graph

@@             Coverage Diff             @@
##           master     #135       +/-   ##
===========================================
- Coverage   87.30%   62.14%   -25.17%     
===========================================
  Files           3       18       +15     
  Lines         386      560      +174     
===========================================
+ Hits          337      348       +11     
- Misses         49      212      +163     
Impacted Files Coverage Δ
src/solve/multistartoptimization.jl 0.00% <0.00%> (ø)
src/solve/quaddirect.jl 0.00% <0.00%> (ø)
src/solve_flux.jl 0.00% <0.00%> (ø)
src/solve_optim.jl 0.00% <0.00%> (ø)
src/solve/solve.jl 33.33% <33.33%> (ø)
src/solve/evolutionary.jl 79.16% <79.16%> (ø)
src/solve/blackboxoptim.jl 80.76% <80.76%> (ø)
src/solve/cmaevolutionstrategy.jl 81.81% <81.81%> (ø)
src/solve/optim.jl 87.75% <87.75%> (ø)
src/solve/flux.jl 89.18% <89.18%> (ø)
... and 25 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 65af75c...63d2a90. Read the comment docs.

@kaandocal
Copy link
Contributor Author

Looks good, can you version bump to 2.0?

I tried, but the minibatch/diffeqflux tests print a warning and ultimately fail:

┌ Warning: Error requiring `ForwardDiff` from `LoopVectorization`                                                                                                                                                  
│   exception =                                                                                                                                                                                                    
│    LoadError: UndefVarError: AbstractSIMD not defined                                                                                                                                                            
│    Stacktrace:                                                                                                                                                                                                   
│      [1] top-level scope                                                                                                                                                                                         
│        @ ~/.julia/packages/LoopVectorization/MVMVN/src/simdfunctionals/vmap_grad_forwarddiff.jl:32
(...)

Seems like this is a versioning issue (haven't been able to track this down precisely)

@ChrisRackauckas
Copy link
Member

@chriselrod ?

@kaandocal
Copy link
Contributor Author

kaandocal commented May 28, 2021

I propose demoting all of these to @require status (except DiffResults) so that users wishing to use GalacticOptim with eg. ForwardDiff only do not need to load 4 other packages.

Yeah change that as well.

I uploaded a commit for this as well. This required reorganising the code (with significantly reduced coverage although I didn't add or remove anything). Feel free to rearrange things as you please! Although many AD/optimisation backend are really not tested at all...

@chriselrod
Copy link

chriselrod commented May 28, 2021

@chriselrod ?

Should be fixed on master. I'll issue a release in the next few hours.
The @require for adding ChainRules support for LoopVectorization.vmap causes a number of issues for a feature that I'm not sure if anyone actually uses.

@ChrisRackauckas
Copy link
Member

The @require for adding ChainRules support for LoopVectorization.vmap causes a number of issues for a feature that I'm not sure if anyone actually uses.

Can you pick that out to a package or something?

@ChrisRackauckas
Copy link
Member

This was rebased and merged in #140 . Next time you might want to work on a branch other than master.

Thanks!

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

Successfully merging this pull request may close these issues.

4 participants