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

threaded total degree solve for multiple sets of parameters #599

Closed
oameye opened this issue Nov 1, 2024 · 2 comments · Fixed by #600
Closed

threaded total degree solve for multiple sets of parameters #599

oameye opened this issue Nov 1, 2024 · 2 comments · Fixed by #600

Comments

@oameye
Copy link
Contributor

oameye commented Nov 1, 2024

Can it be that solving a system with the total_degree method for multiple sets of parameters is not implemented for threading=true? For threading=false it works.

using HomotopyContinuation
@var u1, v1, ω, α, γ, λ, ω0

eqs = [
    -u1*ω^2 + u1*ω0^2 + (3/4)*u1^3*α + (3/4)*u1*v1^2*α + (-1/2)*u1*λ*ω0^2 + v1*γ*ω,
    -v1*ω^2 + v1*ω0^2 + (3/4)*v1^3*α - u1*γ*ω + (3/4)*u1^2*v1*α + (1/2)*v1*λ*ω0^2,
]

F = System(eqs, parameters = [ω, α, γ, λ, ω0], variables = [u1, v1])

input_array = [
    [0.9, 1.0, 0.01, 0.01, 1.1],
    [0.9105263157894737, 1.0, 0.01, 0.01, 1.1],
    [0.9210526315789473, 1.0, 0.01, 0.01, 1.1],
    [0.9315789473684211, 1.0, 0.01, 0.01, 1.1],
    [0.9421052631578948, 1.0, 0.01, 0.01, 1.1],
    [0.9526315789473684, 1.0, 0.01, 0.01, 1.1]]

HomotopyContinuation.solve(
    F;
    start_system=:total_degree,
    target_parameters=input_array,
    threading=true
)
ERROR: MethodError: no method matching threaded_solve(::Solver{…}, ::HomotopyContinuation.TotalDegreeStartSolutionsIterator{…}; catch_interrupt::Bool)

Closest candidates are:
  threaded_solve(::Solver, ::AbstractArray, ::Any, ::Any; catch_interrupt)
   @ HomotopyContinuation C:\Users\User\.julia\packages\HomotopyContinuation\zXiJa\src\solve.jl:582
  threaded_solve(::Solver, ::AbstractArray, ::Any; ...)
   @ HomotopyContinuation C:\Users\User\.julia\packages\HomotopyContinuation\zXiJa\src\solve.jl:582
  threaded_solve(::Solver, ::AbstractArray; ...)
   @ HomotopyContinuation C:\Users\User\.julia\packages\HomotopyContinuation\zXiJa\src\solve.jl:582

Stacktrace:
 [1] many_solve(solver::Solver{…}, starts::HomotopyContinuation.TotalDegreeStartSolutionsIterator{…}, many_target_parameters::Vector{…}, progress::ProgressMeter.Progress, transform_result::typeof(tuple), transform_parameters::typeof(identity), ::Val{…}; threading::Bool, catch_interrupt::Bool)
   @ HomotopyContinuation C:\Users\User\.julia\packages\HomotopyContinuation\zXiJa\src\solve.jl:755
 [2] many_solve
   @ C:\Users\User\.julia\packages\HomotopyContinuation\zXiJa\src\solve.jl:741 [inlined]
 [3] #solve#292
   @ C:\Users\User\.julia\packages\HomotopyContinuation\zXiJa\src\solve.jl:698 [inlined]
 [4] solve(args::System; show_progress::Bool, threading::Bool, catch_interrupt::Bool, target_parameters::Vector{…}, stop_early_cb::Function, transform_result::Nothing, transform_parameters::typeof(identity), flatten::Nothing, target_subspaces::Nothing, kwargs::@Kwargs{})
   @ HomotopyContinuation C:\Users\User\.julia\packages\HomotopyContinuation\zXiJa\src\solve.jl:475
 [5] top-level scope
   @ Untitled-2:26
Some type information was truncated. Use `show(err)` to see complete types.
@oameye
Copy link
Contributor Author

oameye commented Nov 1, 2024

it seems to be because threaded_solve requires starts to be an AbstractArray, whereas serial_solve does not.

@PBrdng
Copy link
Collaborator

PBrdng commented Nov 1, 2024

Yes, this seems to be a bug coming from a wrong type. I'll fix it next week. Thanks for noticing.

oameye added a commit to oameye/HomotopyContinuation.jl that referenced this issue Nov 3, 2024
PBrdng added a commit that referenced this issue Nov 5, 2024
fix: fix total degree with many parameters threaded (#599)
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 a pull request may close this issue.

2 participants