From 4c1545e2d2fc5014b6e10076b93f832b215ba311 Mon Sep 17 00:00:00 2001 From: Alex Jones Date: Tue, 8 Aug 2023 16:27:11 +0100 Subject: [PATCH] Recompile Invalidations --- Project.toml | 1 + src/ModelingToolkit.jl | 136 +++++++++++++++++++++-------------------- 2 files changed, 71 insertions(+), 66 deletions(-) diff --git a/Project.toml b/Project.toml index 1eb70f40d5..bdf9425287 100644 --- a/Project.toml +++ b/Project.toml @@ -31,6 +31,7 @@ LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" MLStyle = "d8e11817-5142-5d16-987a-aa16d5891078" MacroTools = "1914dd2f-81c6-5fcd-8719-6d5c9610ff09" NaNMath = "77ba4419-2d1f-58cd-9bb1-8ffee604a2e3" +PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a" RecursiveArrayTools = "731186ca-8d62-57ce-b412-fbd966d074cd" Reexport = "189a3867-3050-52da-a836-e630ba90ab69" RuntimeGeneratedFunctions = "7e49a35a-f44a-4d26-94aa-eba1b4ca6b47" diff --git a/src/ModelingToolkit.jl b/src/ModelingToolkit.jl index 07f03e5c8e..6a7b11feed 100644 --- a/src/ModelingToolkit.jl +++ b/src/ModelingToolkit.jl @@ -2,75 +2,79 @@ $(DocStringExtensions.README) """ module ModelingToolkit -using DocStringExtensions -using Compat -using AbstractTrees -using DiffEqBase, SciMLBase, ForwardDiff, Reexport -using SciMLBase: StandardODEProblem, StandardNonlinearProblem, handle_varmap -using Distributed -using StaticArrays, LinearAlgebra, SparseArrays, LabelledArrays -using InteractiveUtils -using Latexify, Unitful, ArrayInterface -using MacroTools -@reexport using UnPack -using Setfield, ConstructionBase -using JumpProcesses -using DataStructures -using SpecialFunctions, NaNMath -using RuntimeGeneratedFunctions -using RuntimeGeneratedFunctions: drop_expr -using Base.Threads -using DiffEqCallbacks -using Graphs -import MacroTools: splitdef, combinedef, postwalk, striplines -import Libdl -using DocStringExtensions -using Base: RefValue -using Combinatorics -import IfElse -import Distributions -import FunctionWrappersWrappers -using URIs: URI - +using PrecompileTools, Reexport +@recompile_invalidations begin + using DocStringExtensions + using Compat + using AbstractTrees + using DiffEqBase, SciMLBase, ForwardDiff + using SciMLBase: StandardODEProblem, StandardNonlinearProblem, handle_varmap + using Distributed + using StaticArrays, LinearAlgebra, SparseArrays, LabelledArrays + using InteractiveUtils + using Latexify, Unitful, ArrayInterface + using MacroTools + using Setfield, ConstructionBase + using JumpProcesses + using DataStructures + using SpecialFunctions, NaNMath + using RuntimeGeneratedFunctions + using RuntimeGeneratedFunctions: drop_expr + using Base.Threads + using DiffEqCallbacks + using Graphs + import MacroTools: splitdef, combinedef, postwalk, striplines + import Libdl + using DocStringExtensions + using Base: RefValue + using Combinatorics + import IfElse + import Distributions + import FunctionWrappersWrappers + using URIs: URI + + using RecursiveArrayTools + + import SymbolicIndexingInterface + import SymbolicIndexingInterface: independent_variables, states, parameters + export independent_variables, states, parameters + import SymbolicUtils + import SymbolicUtils: istree, arguments, operation, similarterm, promote_symtype, + Symbolic, isadd, ismul, ispow, issym, FnType, + @rule, Rewriters, substitute, metadata, BasicSymbolic, + Sym, Term + using SymbolicUtils.Code + import SymbolicUtils.Code: toexpr + import SymbolicUtils.Rewriters: Chain, Postwalk, Prewalk, Fixpoint + import JuliaFormatter + + using MLStyle + + using Reexport + using Symbolics: degree + @reexport using Symbolics + using Symbolics: _parse_vars, value, @derivatives, get_variables, + exprs_occur_in, solve_for, build_expr, unwrap, wrap, + VariableSource, getname, variable, Connection, connect, + NAMESPACE_SEPARATOR + import Symbolics: rename, get_variables!, _solve, hessian_sparsity, + jacobian_sparsity, isaffine, islinear, _iszero, _isone, + tosymbol, lower_varname, diff2term, var_from_nested_derivative, + BuildTargets, JuliaTarget, StanTarget, CTarget, MATLABTarget, + ParallelForm, SerialForm, MultithreadedForm, build_function, + rhss, lhss, prettify_expr, gradient, + jacobian, hessian, derivative, sparsejacobian, sparsehessian, + substituter, scalarize, getparent + + import DiffEqBase: @add_kwonly + + import Graphs: SimpleDiGraph, add_edge!, incidence_matrix + + @reexport using UnPack +end RuntimeGeneratedFunctions.init(@__MODULE__) -using RecursiveArrayTools - -import SymbolicIndexingInterface -import SymbolicIndexingInterface: independent_variables, states, parameters -export independent_variables, states, parameters -import SymbolicUtils -import SymbolicUtils: istree, arguments, operation, similarterm, promote_symtype, - Symbolic, isadd, ismul, ispow, issym, FnType, - @rule, Rewriters, substitute, metadata, BasicSymbolic, - Sym, Term -using SymbolicUtils.Code -import SymbolicUtils.Code: toexpr -import SymbolicUtils.Rewriters: Chain, Postwalk, Prewalk, Fixpoint -import JuliaFormatter - -using MLStyle - -using Reexport -using Symbolics: degree -@reexport using Symbolics export @derivatives -using Symbolics: _parse_vars, value, @derivatives, get_variables, - exprs_occur_in, solve_for, build_expr, unwrap, wrap, - VariableSource, getname, variable, Connection, connect, - NAMESPACE_SEPARATOR -import Symbolics: rename, get_variables!, _solve, hessian_sparsity, - jacobian_sparsity, isaffine, islinear, _iszero, _isone, - tosymbol, lower_varname, diff2term, var_from_nested_derivative, - BuildTargets, JuliaTarget, StanTarget, CTarget, MATLABTarget, - ParallelForm, SerialForm, MultithreadedForm, build_function, - rhss, lhss, prettify_expr, gradient, - jacobian, hessian, derivative, sparsejacobian, sparsehessian, - substituter, scalarize, getparent - -import DiffEqBase: @add_kwonly - -import Graphs: SimpleDiGraph, add_edge!, incidence_matrix for fun in [:toexpr] @eval begin