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

Loading…
Cancel
Save