Skip to content
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

Fix 178 precompilation makie #179

Merged
merged 5 commits into from
Oct 4, 2024

Conversation

BambOoxX
Copy link
Contributor

@BambOoxX BambOoxX commented Oct 2, 2024

Attemp at fixing precompilation issues due to Makie usage. See #178

@rveltz
Copy link
Member

rveltz commented Oct 4, 2024

Wow!!!

Thank you a lot for your work. I am testing it and so far it works well. The only thing is the following.

This seems to error

using Revise, GLMakie, LinearAlgebra, BifurcationKit
k = 2
N = 1
F(x, p) = @. p * x + x^(k+1)/(k+1) + 0.01
Jac_m(x, p) = diagm(0 => p .+ x.^k)

# bifurcation problem
prob = BifurcationProblem(F, [0.], 0.5, (@optic _), J = Jac_m)

# continuation options
opts = BK.ContinuationPar(ds=0.001, max_steps = 140, newton_options = NewtonPar(tol = 1e-8))

# algorithm
alg = DefCont(deflation_operator = DeflationOperator(2, .001, [[0.]]), perturb_solution = (x,p,id) -> (x  .+ 0.1 .* rand(length(x))))

brdc = continuation(prob, alg,
	ContinuationPar(opts, ds = -0.001, max_steps = 800, newton_options = NewtonPar(verbose = false, max_iterations = 6), plot_every_step = 40),
	;
	plot=true,
	callback_newton = BK.cbMaxNorm(1e3) # reject newton step if residual too large
	)

because

ERROR: MethodError: no method matching plot_DCont_branch(::BifurcationKit.BK_NoPlot, ::Vector{ContResult{…}}, ::Int64, ::Int64, ::Int64)

Closest candidates are:
  plot_DCont_branch(::BifurcationKit.BK_Makie, ::Any, ::Int64, ::Int64, ::Int64)
   @ GLMakieExt ~/work/prog_gd/julia/dev/dev1/bkorg/BifurcationKitGITHUB/ext/GLMakieExt/plot.jl:245

@BambOoxX
Copy link
Contributor Author

BambOoxX commented Oct 4, 2024

I think I met the same problem, did you try with BifurcationKit.plot_DCont_branch, maybe these are just not properly exported as is.

@rveltz
Copy link
Member

rveltz commented Oct 4, 2024

There is one major issue with this interface: you never have BifurcationKit._plot_backend equal to BK_Makie().

@BambOoxX
Copy link
Contributor Author

BambOoxX commented Oct 4, 2024

Ah yes, my bad, it's a typo, I targeted :MakieExt but you named it :GLMakieExt. I'll fix that right now.
Then, to load get get_plot_backend()==BK_Makie() you just need to do using GLMakie, BifurcationKit

@rveltz
Copy link
Member

rveltz commented Oct 4, 2024

I corrected the change in a previous commit.

As get_plot_backend is not called after loading GLMakie, the const _plot_backend is not updated

@BambOoxX
Copy link
Contributor Author

BambOoxX commented Oct 4, 2024

I solved that in the last commit by triggering an update with __init__s in each plotting extension. Based on the discussion in JuliaLang/julia#13817.

@rveltz rveltz merged commit 5653794 into bifurcationkit:master Oct 4, 2024
2 checks passed
@BambOoxX BambOoxX deleted the fix-178-precompilation-makie branch October 4, 2024 17:37
@rveltz
Copy link
Member

rveltz commented Oct 4, 2024

Great work! Thank you.

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.

2 participants