0
$\begingroup$

I have a problem I want to find numerical solutions for with different starting variables. Let F be a vector supposed to vanish, which in its definition includes the free symbols a, b, c. Then I run

output={alpha,beta,gamma, F};
initialconditions={{gamma, 1}};
Export["numerical.csv",
    N[
        ParallelTable[
            output /. FindRoot[F==0, initialconditions],
            {alpha, 0 Degree, 100 Degree, 20 Degree},
            {beta, 0 Degree, -100 Degree, -20 Degree}
        ]],
    "TSV"
]

Which causes Launching kernels... to appear on the screen. When I check in htop what the Kernels do, I notice that all are sleeping except for the main one; so nothing seems to be run in parallel. The same happens with the following alternative I tried:

tasks = Table[
    ParallelSubmit[
        {F, initialconditions, output, alpha, beta},
        output /. FindRoot[F==0, initialconditions]
    ],
    {alpha, 0 Degree, 100 Degree, 20 Degree},
    {beta, 0 Degree, -100 Degree, -20 Degree}
];
result = WaitAll[tasks];
Export["numeric.csv", result, "TSV"]

What am I doing wrong about parallelisation?

Edit: The problem does not seem to be about FindRoot; at least, when I run it ouside of any parallel context:

Do[
    Print[DecimalForm[N[output]] /. FindRoot[F==0, initialconditions]],
    {alpha, 0 Degree, 100 Degree, 20 Degree},
    {beta, 0 Degree, -100 Degree, -20 Degree},
]

it finds solutions; though very slowly, which is why I want to run this problem in parallel.

$\endgroup$
  • $\begingroup$ I don't know about the parallelization aspect, but does the FindRoot work outside the ParallelTable? Could you include a sample problem? $\endgroup$ – Chris K Nov 15 '18 at 15:51
  • $\begingroup$ @ChrisK See my edit. I will be looking for a complete example that shows the problem. $\endgroup$ – Bubaya Nov 15 '18 at 16:02
  • $\begingroup$ Thanks! From your question, it seems more about finding roots across a range of parameter values, rather than a range of starting values (initialconditions is always {gamma,1}). Is that right? $\endgroup$ – Chris K Nov 15 '18 at 16:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.