Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • 4.6
  • 5.x
  • 6.x
  • aux_vars_fix
  • julia
  • llvm-15
  • master
  • python-codegen
  • rework_pac
  • uop
  • julia-6.2.0
  • julia-6.3.0
  • julia-6.4.0
  • julia-7.0.0
14 results

Target

Select target project
  • normann/preprocessor
  • Dynare/preprocessor
  • FerhatMihoubi/preprocessor
  • MichelJuillard/preprocessor
  • sebastien/preprocessor
  • lnsongxf/preprocessor
  • albop/preprocessor
  • DoraK/preprocessor
  • amg/preprocessor
  • wmutschl/preprocessor
  • JohannesPfeifer/preprocessor
11 results
Select Git revision
  • 4.6
  • aux_vars_fix
  • master
  • occbin
  • pac_composite_target_mce
  • ramsey_k_order
  • rework_pac
  • uop
  • created_preprocessor_repo
9 results
Show changes

Commits on Source 6

...@@ -8,7 +8,7 @@ variables: ...@@ -8,7 +8,7 @@ variables:
build_linux_x86_64: build_linux_x86_64:
stage: build stage: build
script: script:
- meson setup -D buildtype=release build - meson setup --buildtype=release -Db_lto=true build
- meson compile -C build -v - meson compile -C build -v
artifacts: artifacts:
paths: paths:
...@@ -17,7 +17,7 @@ build_linux_x86_64: ...@@ -17,7 +17,7 @@ build_linux_x86_64:
build_linux_arm64: build_linux_arm64:
stage: build stage: build
script: script:
- meson setup -D buildtype=release --cross-file scripts/linux-arm64-cross.ini build - meson setup --buildtype=release -Db_lto=true --cross-file scripts/linux-arm64-cross.ini build
- meson compile -C build -v - meson compile -C build -v
artifacts: artifacts:
paths: paths:
...@@ -31,7 +31,7 @@ build_windows_x86_64: ...@@ -31,7 +31,7 @@ build_windows_x86_64:
- mkdir -p deps - mkdir -p deps
- tar xf tarballs/mingw-w64-x86_64-boost-$MINGW64_BOOST_VERSION-any.pkg.tar.zst --directory deps - tar xf tarballs/mingw-w64-x86_64-boost-$MINGW64_BOOST_VERSION-any.pkg.tar.zst --directory deps
- echo -e "[properties]\nboost_root = '$(pwd)/deps/mingw64/'" > boost.ini - echo -e "[properties]\nboost_root = '$(pwd)/deps/mingw64/'" > boost.ini
- meson setup -D buildtype=release --cross-file scripts/windows-cross.ini --cross-file boost.ini build - meson setup --buildtype=release -Db_lto=true --cross-file scripts/windows-cross.ini --cross-file boost.ini build
- meson compile -C build -v - meson compile -C build -v
cache: cache:
# This cache is shared between all branches, to save space # This cache is shared between all branches, to save space
...@@ -47,7 +47,7 @@ build_macos_x86_64: ...@@ -47,7 +47,7 @@ build_macos_x86_64:
tags: tags:
- macOS - macOS
script: script:
- arch -x86_64 meson setup -D buildtype=release --native-file scripts/homebrew-native-x86_64.ini build - arch -x86_64 meson setup --buildtype=release -Db_lto=true --native-file scripts/homebrew-native-x86_64.ini build
- arch -x86_64 meson compile -C build -v - arch -x86_64 meson compile -C build -v
artifacts: artifacts:
paths: paths:
...@@ -59,7 +59,7 @@ build_macos_arm64: ...@@ -59,7 +59,7 @@ build_macos_arm64:
- macOS - macOS
script: script:
- export PATH="/opt/homebrew/bin:$PATH" - export PATH="/opt/homebrew/bin:$PATH"
- arch -arm64 meson setup -D buildtype=release --native-file scripts/homebrew-native-arm64.ini build - arch -arm64 meson setup --buildtype=release -Db_lto=true --native-file scripts/homebrew-native-arm64.ini build
- arch -arm64 meson compile -C build -v - arch -arm64 meson compile -C build -v
artifacts: artifacts:
paths: paths:
......
...@@ -219,13 +219,13 @@ RIGHT_ARRAY_SUBSCRIPT(ExprNodeOutputType output_type) ...@@ -219,13 +219,13 @@ RIGHT_ARRAY_SUBSCRIPT(ExprNodeOutputType output_type)
} }
// Left and right parentheses // Left and right parentheses
inline string constexpr string
LEFT_PAR(ExprNodeOutputType output_type) LEFT_PAR(ExprNodeOutputType output_type)
{ {
return isLatexOutput(output_type) ? "\\left(" : "("; return isLatexOutput(output_type) ? "\\left(" : "(";
} }
inline string constexpr string
RIGHT_PAR(ExprNodeOutputType output_type) RIGHT_PAR(ExprNodeOutputType output_type)
{ {
return isLatexOutput(output_type) ? "\\right)" : ")"; return isLatexOutput(output_type) ? "\\right)" : ")";
......
/* /*
* Copyright © 2015-2023 Dynare Team * Copyright © 2015-2025 Dynare Team
* *
* This file is part of Dynare. * This file is part of Dynare.
* *
...@@ -52,15 +52,8 @@ macroExpandModFile(const filesystem::path& filename, const istream& modfile, boo ...@@ -52,15 +52,8 @@ macroExpandModFile(const filesystem::path& filename, const istream& modfile, boo
string str(macro_output.str()); string str(macro_output.str());
if (!line_macro) if (!line_macro)
{ {
/* Remove the @#line directives. // Remove the @#line directives.
Unfortunately GCC 11 does not yet support std::regex::multiline str = regex_replace(str, regex(R"(^@#line.*$)", std::regex::multiline), "");
(despite it being in the C++17 standard), so we are forced to use
a trick to emulate the “usual” behaviour of the caret ^;
here, the latter only matches the beginning of file.
This also means that we are forced to remove the EOL before the
@#line, and not the one after it (matching the EOL before and the
EOL after in the same regexp does not work). */
str = regex_replace(str, regex(R"((^|\r?\n)@#line.*)"), "");
/* Remove the EOLs at the beginning of the output, the first one /* Remove the EOLs at the beginning of the output, the first one
being a remnant of the first @#line directive. */ being a remnant of the first @#line directive. */
str = regex_replace(str, regex(R"(^(\r?\n)+)"), ""); str = regex_replace(str, regex(R"(^(\r?\n)+)"), "");
......
...@@ -1010,7 +1010,6 @@ ModelTree::writeModelCFile(const string& basename, const string& mexext, ...@@ -1010,7 +1010,6 @@ ModelTree::writeModelCFile(const string& basename, const string& mexext,
: ExprNodeOutputType::CStaticModel>(); : ExprNodeOutputType::CStaticModel>();
vector<filesystem::path> header_files, object_files; vector<filesystem::path> header_files, object_files;
// TODO: when C++20 support is complete, mark the following strings constexpr
const string prefix {dynamic ? "dynamic_" : "static_"}; const string prefix {dynamic ? "dynamic_" : "static_"};
const string ss_it_argin {dynamic ? ", const double *restrict steady_state, int it_" : ""}; const string ss_it_argin {dynamic ? ", const double *restrict steady_state, int it_" : ""};
const string ss_it_argout {dynamic ? ", steady_state, it_" : ""}; const string ss_it_argout {dynamic ? ", steady_state, it_" : ""};
...@@ -2270,7 +2269,6 @@ template<bool dynamic> ...@@ -2270,7 +2269,6 @@ template<bool dynamic>
void void
ModelTree::writeJsonSparseIndicesHelper(ostream& output) const ModelTree::writeJsonSparseIndicesHelper(ostream& output) const
{ {
// TODO: when C++20 support is complete, mark this constexpr
const string model_name {dynamic ? "dynamic" : "static"}; const string model_name {dynamic ? "dynamic" : "static"};
// Write indices for the sparse Jacobian (both naive and CSC storage) // Write indices for the sparse Jacobian (both naive and CSC storage)
...@@ -2382,7 +2380,6 @@ ModelTree::writeSparseModelJuliaFiles(const string& basename) const ...@@ -2382,7 +2380,6 @@ ModelTree::writeSparseModelJuliaFiles(const string& basename) const
: ExprNodeOutputType::juliaSparseStaticModel>(); : ExprNodeOutputType::juliaSparseStaticModel>();
filesystem::path julia_dir {filesystem::path {basename} / "model" / "julia"}; filesystem::path julia_dir {filesystem::path {basename} / "model" / "julia"};
// TODO: when C++20 support is complete, mark the following strings constexpr
const string prefix {dynamic ? "SparseDynamic" : "SparseStatic"}; const string prefix {dynamic ? "SparseDynamic" : "SparseStatic"};
const string ss_argin {dynamic ? ", steady_state::Vector{<: Real}" : ""}; const string ss_argin {dynamic ? ", steady_state::Vector{<: Real}" : ""};
const string ss_argout {dynamic ? ", steady_state" : ""}; const string ss_argout {dynamic ? ", steady_state" : ""};
...@@ -2495,7 +2492,6 @@ ModelTree::writeSparseModelMFiles(const string& basename, ...@@ -2495,7 +2492,6 @@ ModelTree::writeSparseModelMFiles(const string& basename,
auto [d_sparse_output, tt_sparse_output] = writeModelFileHelper<output_type>(); auto [d_sparse_output, tt_sparse_output] = writeModelFileHelper<output_type>();
const filesystem::path m_dir {packageDir(basename) / "+sparse"}; const filesystem::path m_dir {packageDir(basename) / "+sparse"};
// TODO: when C++20 support is complete, mark the following strings constexpr
const string prefix { const string prefix {
(dynamic ? "dynamic_"s : "static_"s) (dynamic ? "dynamic_"s : "static_"s)
+ (heterogeneous_dimension ? "het"s + to_string(*heterogeneous_dimension + 1) + "_"s : ""s)}; + (heterogeneous_dimension ? "het"s + to_string(*heterogeneous_dimension + 1) + "_"s : ""s)};
...@@ -2672,7 +2668,6 @@ ModelTree::writeSparseModelCFiles(const string& basename, const string& mexext, ...@@ -2672,7 +2668,6 @@ ModelTree::writeSparseModelCFiles(const string& basename, const string& mexext,
const filesystem::path mex_dir {packageDir(basename) / "+sparse"}; const filesystem::path mex_dir {packageDir(basename) / "+sparse"};
const filesystem::path model_src_dir {filesystem::path {basename} / "model" / "src" / "sparse"}; const filesystem::path model_src_dir {filesystem::path {basename} / "model" / "src" / "sparse"};
// TODO: when C++20 support is complete, mark the following strings constexpr
const string prefix {dynamic ? "dynamic_" : "static_"}; const string prefix {dynamic ? "dynamic_" : "static_"};
const string extra_argin { const string extra_argin {
(dynamic ? ", const double *restrict steady_state"s : ""s) (dynamic ? ", const double *restrict steady_state"s : ""s)
...@@ -3029,15 +3024,18 @@ ModelTree::writeSparseModelCFiles(const string& basename, const string& mexext, ...@@ -3029,15 +3024,18 @@ ModelTree::writeSparseModelCFiles(const string& basename, const string& mexext,
if (!evaluate) if (!evaluate)
output << " mxArray *residual_mx = mxCreateDoubleMatrix(" << blocks[blk].mfs_size output << " mxArray *residual_mx = mxCreateDoubleMatrix(" << blocks[blk].mfs_size
<< ", 1, mxREAL);" << endl << ", 1, mxREAL);" << endl
<< " double *restrict residual = mxGetPr(residual_mx);" << endl << " double *restrict residual = mxGetPr(residual_mx);" << endl;
<< " if (nlhs > 2)" << endl
<< " plhs[2] = residual_mx;" << endl;
output << " " << funcname << "_resid(y, x, params" << extra_argout << ", T" output << " " << funcname << "_resid(y, x, params" << extra_argout << ", T"
<< (evaluate ? "" : ", residual") << ");" << endl; << (evaluate ? "" : ", residual") << ");" << endl;
if (!evaluate) if (!evaluate)
{ {
output << " if (nlhs > 2)" << endl
<< " plhs[2] = residual_mx;" << endl
<< " else" << endl
<< " mxDestroyArray(residual_mx);" << endl;
// Write Jacobian // Write Jacobian
output << " if (nlhs > 3)" << endl << " {" << endl; output << " if (nlhs > 3)" << endl << " {" << endl;
sparse_jacobian_create(3, blocks[blk].mfs_size, g1_ncols, sparse_jacobian_create(3, blocks[blk].mfs_size, g1_ncols,
...@@ -3062,7 +3060,6 @@ ModelTree::writeDebugModelMFiles(const string& basename) const ...@@ -3062,7 +3060,6 @@ ModelTree::writeDebugModelMFiles(const string& basename) const
: ExprNodeOutputType::matlabSparseStaticModel}; : ExprNodeOutputType::matlabSparseStaticModel};
const filesystem::path m_dir {packageDir(basename) / "+debug"}; const filesystem::path m_dir {packageDir(basename) / "+debug"};
// TODO: when C++20 support is complete, mark the following strings constexpr
const string prefix {dynamic ? "dynamic_" : "static_"}; const string prefix {dynamic ? "dynamic_" : "static_"};
const filesystem::path resid_filename {m_dir / (prefix + "resid.m")}; const filesystem::path resid_filename {m_dir / (prefix + "resid.m")};
......