How to use sundials solvers in threads parpool?

Is there a way to call sundials solvers directly in matlab, without simbiology and ode objects?
I am trying to run simulations in a threads based parallel pool, which apparently rules out the approach of using an ode object, since the function 'solve' seems to be not safe for parallel computing:
When I call solve in a threads based parfor loop, I receive the following error:
Error using matlab.ode.internal.DESolver/solveLoop (line 236)
The specified superclass 'matlab.ode.internal.SimulatorBase' contains a
parse error, cannot be found on MATLAB's search path, or is shadowed by
another file with the same name.
Any ideas?

 Accepted Answer

I'm not aware of any way to do this. The only workaround I can think of is to use a process pool instead of a thread pool.

4 Comments

Torsten
Torsten on 28 Apr 2025
Edited: Torsten on 28 Apr 2025
Do you know if the SUNDIALS DAE solvers can be called directly, thus outside the "ode" - "solve" environment (like ode45, ode15s etc.) ?
I don't think SUNDIALS can be called directly. But let me see if I can get a more definitive answer from colleagues who work on the ODE interfaces in MATLAB. (I'm a SimBiology developer, so that's the functionality I'm most familiar with.)
Ok, I just chatted with a coworker. I don't think we currently have any plans to expose SUNDIALS except via the ODE object. But we are aware of the need to support ODE objects with thread pools. So I would keep an eye on upcoming release notes to see if that support has been added. (And for future readers of this post, I current see that we don't yet have support as of R2024b or the R2025a prerelease. So check back in R2025b.)
If you have a reason for using SUNDIALS separate from the ODE objects, please reach out to me or Tech Support to privde more details, so that we can also consider that in a future release.
Thank you very much for the information. I just saw here under MATLAB answers that the solver was asked for several times - that's why I posted the question.

Sign in to comment.

More Answers (0)

Categories

Products

Release

R2024b

Asked:

on 28 Apr 2025

Commented:

on 28 Apr 2025

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!