mirror of
https://github.com/BachoSeven/homotopy-continuation.git
synced 2026-10-06 22:55:15 +00:00
feat: temptative distributed code
This commit is contained in:
Binary file not shown.
+2
-3
@@ -203,8 +203,8 @@ This was done in Julia by using the \texttt{Threads.@threads} macro, which autom
|
|||||||
However, in the case of looping over multiple roots, this didn't improve the performance, as the overhead of the multithreading was too big compared to the actual computation time,
|
However, in the case of looping over multiple roots, this didn't improve the performance, as the overhead of the multithreading was too big compared to the actual computation time,
|
||||||
as the systems were too small to benefit from this kind of parallelization, as can be seen by the results in Appendix \hyperref[sec:mt]{B}.
|
as the systems were too small to benefit from this kind of parallelization, as can be seen by the results in Appendix \hyperref[sec:mt]{B}.
|
||||||
|
|
||||||
\subsection{MPI}
|
\subsection{Distributed}
|
||||||
Next, we tried to use MPI to parallelize the tracking of the roots.
|
Next, we tried to use \textit{Distributed.jl} to parallelize the tracking of the roots.
|
||||||
This was done by using the \texttt{MPI.jl} \cite{JuliaMPI} package, which provides a Julia interface to the MPI library.
|
This was done by using the \texttt{MPI.jl} \cite{JuliaMPI} package, which provides a Julia interface to the MPI library.
|
||||||
|
|
||||||
\section{Appendix A: Implementation}
|
\section{Appendix A: Implementation}
|
||||||
@@ -267,5 +267,4 @@ Here are the plots for the solutions of four different 2x2 systems, with the sin
|
|||||||
|
|
||||||
\thebibliography{2}
|
\thebibliography{2}
|
||||||
\bibitem{BertiniBook} Bates, Daniel J. \textit{Numerically solving polynomial systems with Bertini}. SIAM, Society for Industrial Applied Mathematics, 2013.
|
\bibitem{BertiniBook} Bates, Daniel J. \textit{Numerically solving polynomial systems with Bertini}. SIAM, Society for Industrial Applied Mathematics, 2013.
|
||||||
\bibitem{JuliaMPI} Simon Byrne, Lucas C. Wilcox, and Valentin Churavy (2021) "MPI.jl: Julia bindings for the Message Passing Interface". JuliaCon Proceedings, 1(1), 68, doi: 10.21105/jcon.00068
|
|
||||||
\end{document}
|
\end{document}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
# External dependencies
|
# External dependencies
|
||||||
using TypedPolynomials
|
using TypedPolynomials
|
||||||
using LinearAlgebra
|
using LinearAlgebra
|
||||||
|
using Distributed
|
||||||
|
|
||||||
# Local dependencies
|
# Local dependencies
|
||||||
include("random_poly.jl")
|
include("random_poly.jl")
|
||||||
@@ -16,15 +17,17 @@ using .EulerNewton
|
|||||||
using .AdaptStep
|
using .AdaptStep
|
||||||
using .Plot
|
using .Plot
|
||||||
|
|
||||||
|
# Launch worker processes
|
||||||
|
num_cores = parse(Int, ENV["SLURM_CPUS_PER_TASK"])
|
||||||
|
addprocs(num_cores)
|
||||||
|
|
||||||
# Main homotopy continuation loop
|
# Main homotopy continuation loop
|
||||||
function solve(F, (G, roots) = start_system(F), maxsteps = 1000)
|
function solve(F, (G, roots) = start_system(F), maxsteps = 1000)
|
||||||
H=homotopy(F,G)
|
H=homotopy(F,G)
|
||||||
solutions = []
|
solutions = []
|
||||||
step_array = []
|
step_array = []
|
||||||
|
|
||||||
Threads.@threads for r in roots
|
@distributed for r in roots
|
||||||
# for r in roots
|
|
||||||
println("New root")
|
|
||||||
t = 1.0
|
t = 1.0
|
||||||
step_size = 0.01
|
step_size = 0.01
|
||||||
x0 = r
|
x0 = r
|
||||||
@@ -41,6 +44,9 @@ function solve(F, (G, roots) = start_system(F), maxsteps = 1000)
|
|||||||
push!(step_array, steps)
|
push!(step_array, steps)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Gather results from worker processes
|
||||||
|
solutions = fetch(solutions)
|
||||||
|
step_array = fetch(step_array)
|
||||||
return (solutions, step_array)
|
return (solutions, step_array)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user