Add ClusterManagers

main
Francesco Minnocci 1 year ago
parent 79a162cfdb
commit f114eeec77
Signed by untrusted user: BachoSeven
GPG Key ID: 2BE4AB7FDAD828A4

@ -2,6 +2,7 @@
using TypedPolynomials using TypedPolynomials
using LinearAlgebra using LinearAlgebra
using Distributed using Distributed
using ClusterManagers
# Local dependencies # Local dependencies
include("random_poly.jl") include("random_poly.jl")
@ -18,16 +19,9 @@ using .AdaptStep
using .Plot using .Plot
# Launch worker processes # Launch worker processes
num_cores = parse(Int, ENV["SLURM_CPUS_PER_TASK"]) addprocs(SlurmManager(40), N=20, t="01:00:00"))
addprocs(num_cores)
# Main homotopy continuation loop function compute_root(H, r, maxsteps)
function solve(F, (G, roots) = start_system(F), maxsteps = 1000)
H=homotopy(F,G)
solutions = []
step_array = []
@distributed for r in roots
t = 1.0 t = 1.0
step_size = 0.01 step_size = 0.01
x0 = r x0 = r
@ -40,14 +34,21 @@ function solve(F, (G, roots) = start_system(F), maxsteps = 1000)
t -= step_size t -= step_size
steps += 1 steps += 1
end end
push!(solutions, x0) return (x0, steps)
push!(step_array, steps) end
# Main homotopy continuation loop
function solve(F, (G, roots) = start_system(F))
H=homotopy(F,G)
@distributed for r in roots
(solutions, step_array) = compute_root(H, r, maxsteps = 1000)
end end
# Gather results from worker processes # Gather results from worker processes
solutions = fetch(solutions) sols = fetch(solutions)
step_array = fetch(step_array) steps = fetch(step_array)
return (solutions, step_array) return (sols, steps)
end end
# Input polynomial systems # Input polynomial systems

Loading…
Cancel
Save