How to Use ModelingToolkit.jl Tearing Parallelism

In the documentation for ModelingToolkit.jl - Exposing More Parallelism By Tearing Algebraic Equations in ODESystems I read

you can construct the ODEProblem / ODAEProblem and set parallel_form to use the exposed parallelism in multithreaded function constructions

I’m assuming this means that I should setup the problem as

prob = ODEProblem(sys, [], (0.0, 1.0); parallel=ModelingToolkit.MultithreadedForm())

Is my assumption correct here, or am I missing something?

I don’t see any speed improvements using MultithreadedForm(), in fact the solver is slower this way compared with using SerialForm().

Also, side note, I see a couple bugs in the copy/paste code, will submit an issue on Github.

The speed will greatly depend on the model. That tutorial is too small to overcome thread overhead and is just a demo.

Ah I see, so looks like I’m using the correct keyword arg.

I also see in ModelingToolkit.jl there is a ParallelForm() but this doesn’t seem to be supported yet. Is this setting another possibility that will leverage the tearing parallelism?

A little background, I’ve now successfully moved my large system model from Matlab SimScape to ModelingToolkit.jl, but I’m not getting the same speed. In SimScape I use the Partitioning Solver (Increase Simulation Speed Using the Partitioning Solver - MATLAB & Simulink) which I’m assuming is similar to the Tearing Parallelism of ModelingToolkit. I may of course not be getting the same speed because of some inefficiencies I need to clean up, but I just wanted to confirm that theoretically, I should be able to match, if not exceed the SimScape speed.

It was there, but in the great Symbolics.jl change I think @shashi broke it and didn’t fix it… but it’s hard to get a speedup with distributed parallelism in that anyways: our serial form is too optimized. We’ll need to add it back and try it on 100,000+ equation models.