introduced SharedArrays; can we enumerate?

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

@ -2,7 +2,7 @@
using TypedPolynomials
using LinearAlgebra
using Distributed
using ClusterManagers
using SharedArrays
# Local dependencies
include("random_poly.jl")
@ -18,10 +18,7 @@ using .EulerNewton
using .AdaptStep
using .Plot
# Launch worker processes
addprocs(SlurmManager(40), N=20, t="01:00:00"))
function compute_root(H, r, maxsteps)
function compute_root(H, r, maxsteps=1000)
t = 1.0
step_size = 0.01
x0 = r
@ -41,13 +38,14 @@ end
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)
sols = SharedArray{Complex{Float64}}(length(roots))
steps = SharedArray{Int64}(length(roots))
@sync @distributed for (i, r) in enumerate(roots)
(solutions, step_array) = compute_root(H, r)
sols[i] = solutions
steps[i] = step_array
end
# Gather results from worker processes
sols = fetch(solutions)
steps = fetch(step_array)
return (sols, steps)
end

Loading…
Cancel
Save