I've long believed that NDSolve
cannot make use of multiple cores to solve ODE system, but things seem to be different at least since v12. Consider the following toy example:
$Version
(* "12.0.0 for Microsoft Windows (64-bit) (May 19, 2019)" *)
(* Tested on a 8-core machine. *)
eq = 2 y''[x] == y'[x] - 3 y[x] - 4;
ic = {y[0] == 5, y'[0] == 7};
With[{n = 4096}, sys = Table[{eq, ic} /. y -> y@i, {i, n}];
NDSolve[sys, y /@ Range@n, {x, 0, 10^3}]]
Seems that when n >= 4096
, NDSolve
automatically parallelizes. I'm pretty sure this isn't the case in v9.
So my question is:
In which version was this optimization introduced?
In what situation does the parallelization happen? More tests show the threshold depends on the specific system being solved. In certain situations (e.g. this) parallelization seems to never happen.
Can we make
NDSolve
parallel forn < 4096
? Is the parallelization controlled by any option?
NDSolve
parallelization on several occasions, and not just with enormous numbers of equations. However, I did not pay attention to the characteristics of the equations to be solved. Good question (+1). $\endgroup$