From 0a02e1b1c5d22050e05bc7614057ec966f4898b6 Mon Sep 17 00:00:00 2001 From: lassepe Date: Wed, 11 Oct 2023 17:56:35 +0200 Subject: [PATCH] Support setting parallel form in Symbolics dispatch --- src/parametric_problem.jl | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/parametric_problem.jl b/src/parametric_problem.jl index 06d39ad..336502d 100644 --- a/src/parametric_problem.jl +++ b/src/parametric_problem.jl @@ -77,6 +77,7 @@ function ParametricMCP( lower_bounds, upper_bounds; compute_sensitivities = true, + parallel = nothing, ) length(lower_bounds) == length(upper_bounds) || throw(ArgumentError("lower_bounds and upper_bounds have inconsistent lenghts.")) @@ -91,7 +92,12 @@ function ParametricMCP( # compile all the symbolic expressions into callable julia code f! = let - _f! = Symbolics.build_function(f_symbolic, [z_symbolic; θ_symbolic]; expression = Val{false})[2] + _f! = Symbolics.build_function( + f_symbolic, + [z_symbolic; θ_symbolic]; + expression = Val{false}, + parallel, + )[2] (result, z, θ) -> _f!(result, [z; θ]) end @@ -100,6 +106,7 @@ function ParametricMCP( jacobian_z_symbolic, [z_symbolic; θ_symbolic]; expression = Val{false}, + parallel, )[2] rows, cols, _ = SparseArrays.findnz(jacobian_z_symbolic) @@ -115,6 +122,7 @@ function ParametricMCP( jacobian_θ_symbolic, [z_symbolic; θ_symbolic]; expression = Val{false}, + parallel, )[2] rows, cols, _ = SparseArrays.findnz(jacobian_θ_symbolic) SparseFunction(rows, cols, size(jacobian_θ_symbolic)) do result, z, θ