Does dsolve benefit from multiple cores?
2 views (last 30 days)
Show older comments
I want to solve a first order linear system of 50 equations and variables and I have access to a server. Would the dsolve function run fast with multiple cores? I dont even know how much time it takes to run in my personal PC because after one day running I had to stop the process.
0 Comments
Accepted Answer
John D'Errico
on 7 Mar 2023
Edited: John D'Errico
on 7 Mar 2023
In general, no. No tools in the symbolic toolbox that I know of are currently set up to employ multiple cores. I might have missed something, but I've been a moderately heavy syms user over the years.
That may change with time of course, in fact I could argue there are a couple of problems which could easily benefit from multiple cores. The examples I would see most prominently are the factoring of large integers (which might employ perhaps a quadratic sieve or elliptic curve methods), or testing large integers for primality (which might employ the MIller-Rabin algorithm.) All of those algorithms would seem to have good potential as multi-threaded code.
As far as the solution of a first order linear ODE system with 50 variables, DON'T DO IT SYMBOLICALLY. Even if you had multiple cores, this is the kind of problem where you will not see sufficient benefit, even if you had hundreds of cores, AND the code really was multithreaded. That is the sort of problem you will need to solve numerically. Sorry. And that means of course, that ALL constants need to be provided in advance as numbers. Sorry again. Odds are, even with a thousand cores available, your computer will turn to dust before it finishes that computation in symbolic form.
0 Comments
More Answers (1)
Jan
on 7 Mar 2023
Edited: Jan
on 7 Mar 2023
Open the TaskManager and look at the CPU usage. Does dsolve use one or all cores? This is a strong hint to decide, if it is multithreaded.
You can use the profiler to find the bottleneck of the code. Maybe it is a repated call of an expensive function like exp() with the same input or a forgotton pre-allocation.
profile on
... start your dsolve command
... after 5 minutes press Ctrl-C
profile report
0 Comments
See Also
Categories
Find more on Calculus in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!