Skip to content

mtkcompile performance on large system of ODEs #3919

@sablonl

Description

@sablonl

For my research, I used ModelingToolkit to port an advection–reaction box model in Julia. When the discretization (and hence the number of equations) is relatively small (say up to ~500), everything works smoothly with the latest version. However, when I increase the resolution of my model (up to 5,000–6,000 equations), compilation never finishes (I stopped mtkcompile after 20 hours).

At the moment, my workaround is to use JuliaSimCompiler.jl with an older version of ModelingToolkit.jl. In this setup, structural_simplify takes around 10 seconds. However, this is not ideal since the package is no longer maintained and is also cumbersome to install (e.g., it requires Julia < 1.10.0).

I ran some tests on a very simplified version of my model and found that compiling a system with O(10^3) very simple equations would still take several hours. See https://github.com/sablonl/MWE_MTK.jl for the MWE.

I know that the latest version is more efficient in terms of symbolic reduction, but the time required makes it completely unusable in my case. So here is my question: are there plans to either match the performance of JuliaSimCompiler in terms of compilation time, propose an alternative fast_mtkcompile option that trades optimization for speed, or enable multithreading during simplification?

Thanks,
L.

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions