diff --git a/.github/workflows/build-test-release.yml b/.github/workflows/build-test-release.yml index 80317040f0..2ec72669c8 100644 --- a/.github/workflows/build-test-release.yml +++ b/.github/workflows/build-test-release.yml @@ -69,11 +69,11 @@ jobs: - name: Install packages run: | sudo apt-get update - sudo apt-get install -y ninja-build gcc-14 g++-14 clang-18 - sudo ln -s /usr/bin/clang-18 /usr/local/bin/clang - sudo ln -s /usr/bin/clang++-18 /usr/local/bin/clang++ - sudo ln -s /usr/bin/gcc-14 /usr/local/bin/gcc - sudo ln -s /usr/bin/g++-14 /usr/local/bin/g++ + sudo apt-get install -y ninja-build gcc-16 g++-16 clang-22 + sudo ln -s /usr/bin/clang-22 /usr/local/bin/clang + sudo ln -s /usr/bin/clang++-22 /usr/local/bin/clang++ + sudo ln -s /usr/bin/gcc-16 /usr/local/bin/gcc + sudo ln -s /usr/bin/g++-16 /usr/local/bin/g++ - name: Install uv uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0 diff --git a/.github/workflows/check-build-reproducibility.yml b/.github/workflows/check-build-reproducibility.yml index 5bd9c268ba..efd08d74c4 100644 --- a/.github/workflows/check-build-reproducibility.yml +++ b/.github/workflows/check-build-reproducibility.yml @@ -34,11 +34,11 @@ jobs: - name: Install packages run: | sudo apt-get update - sudo apt-get install -y ninja-build gcc-14 g++-14 clang-18 - sudo ln -s /usr/bin/clang-18 /usr/local/bin/clang - sudo ln -s /usr/bin/clang++-18 /usr/local/bin/clang++ - sudo ln -s /usr/bin/gcc-14 /usr/local/bin/gcc - sudo ln -s /usr/bin/g++-14 /usr/local/bin/g++ + sudo apt-get install -y ninja-build gcc-16 g++-16 clang-22 + sudo ln -s /usr/bin/clang-22 /usr/local/bin/clang + sudo ln -s /usr/bin/clang++-22 /usr/local/bin/clang++ + sudo ln -s /usr/bin/gcc-16 /usr/local/bin/gcc + sudo ln -s /usr/bin/g++-16 /usr/local/bin/g++ - name: Install uv uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0 diff --git a/.github/workflows/check-code-quality.yml b/.github/workflows/check-code-quality.yml index a694009332..4811659dae 100644 --- a/.github/workflows/check-code-quality.yml +++ b/.github/workflows/check-code-quality.yml @@ -27,12 +27,17 @@ jobs: - name: Checkout uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + - name: Install packages + run: | + sudo apt-get update + sudo apt-get install -y ninja-build gcc-16 g++-16 + - name: Install uv uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0 - name: Install most linters from uv run: | - CC=gcc-14 CXX=g++-14 uv sync --locked --group lint + CC=gcc-16 CXX=g++-16 uv sync --locked --group lint - name: Run mypy run: | diff --git a/.github/workflows/clang-tidy.yml b/.github/workflows/clang-tidy.yml index 85f9624a0b..39abf636d6 100644 --- a/.github/workflows/clang-tidy.yml +++ b/.github/workflows/clang-tidy.yml @@ -53,9 +53,9 @@ jobs: - name: Install packages run: | sudo apt-get update - sudo apt-get install -y ninja-build clang-18 clang-tidy-18 - sudo ln -s /usr/bin/clang-18 /usr/local/bin/clang - sudo ln -s /usr/bin/clang++-18 /usr/local/bin/clang++ + sudo apt-get install -y ninja-build clang-22 clang-tidy-18 + sudo ln -s /usr/bin/clang-22 /usr/local/bin/clang + sudo ln -s /usr/bin/clang++-22 /usr/local/bin/clang++ sudo ln -s /usr/bin/clang-tidy-18 /usr/local/bin/clang-tidy - name: Install uv diff --git a/.github/workflows/sonar.yml b/.github/workflows/sonar.yml index d247e157ea..7360cf8b2b 100644 --- a/.github/workflows/sonar.yml +++ b/.github/workflows/sonar.yml @@ -25,7 +25,7 @@ jobs: env: BUILD_WRAPPER_OUT_DIR: build_wrapper_output_directory # Directory where build-wrapper output will be placed CMAKE_PREFIX_PATH: /home/linuxbrew/.linuxbrew - LLVM_COV: llvm-cov-18 + LLVM_COV: llvm-cov-22 HOMEBREW_FORCE_BREWED_CURL: 1 steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 @@ -34,9 +34,9 @@ jobs: - name: Install packages run: | sudo apt-get update - sudo apt-get install -y ninja-build clang-18 lcov gcovr - sudo ln -s /usr/bin/clang-18 /usr/local/bin/clang - sudo ln -s /usr/bin/clang++-18 /usr/local/bin/clang++ + sudo apt-get install -y ninja-build clang-22 lcov gcovr + sudo ln -s /usr/bin/clang-22 /usr/local/bin/clang + sudo ln -s /usr/bin/clang++-22 /usr/local/bin/clang++ - name: Install uv uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0 - name: Install pgm-build-deps diff --git a/.github/workflows/thread-sanitizer.yml b/.github/workflows/thread-sanitizer.yml index fef6785db7..faf3430519 100644 --- a/.github/workflows/thread-sanitizer.yml +++ b/.github/workflows/thread-sanitizer.yml @@ -34,9 +34,9 @@ jobs: - name: Install packages run: | sudo apt-get update - sudo apt-get install -y ninja-build clang-18 - sudo ln -s /usr/bin/clang-18 /usr/local/bin/clang - sudo ln -s /usr/bin/clang++-18 /usr/local/bin/clang++ + sudo apt-get install -y ninja-build clang-22 + sudo ln -s /usr/bin/clang-22 /usr/local/bin/clang + sudo ln -s /usr/bin/clang++-22 /usr/local/bin/clang++ - name: Install uv uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0 diff --git a/.readthedocs.yaml b/.readthedocs.yaml index 9651dc1aba..c12fe4ab61 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -14,8 +14,8 @@ build: - graphviz - graphviz-tools - libgvplugin-neato-layout8 - - gcc-14 - - g++-14 + - gcc-16 + - g++-16 tools: python: "3.14" jobs: @@ -26,7 +26,7 @@ build: create_environment: - uv venv "${READTHEDOCS_VIRTUALENV_PATH}" install: - - CC=gcc-14 CXX=g++-14 UV_PROJECT_ENVIRONMENT="${READTHEDOCS_VIRTUALENV_PATH}" uv sync --locked --group doc + - CC=gcc-16 CXX=g++-16 UV_PROJECT_ENVIRONMENT="${READTHEDOCS_VIRTUALENV_PATH}" uv sync --locked --group doc post_install: # remove API DLL define in header - find power_grid_model_c/power_grid_model_c/include -name *.h -exec sed -i -r "s/#define PGM.*//g" {} \; diff --git a/docs/advanced_documentation/build-guide.md b/docs/advanced_documentation/build-guide.md index 9984dc077d..395a79e0c5 100644 --- a/docs/advanced_documentation/build-guide.md +++ b/docs/advanced_documentation/build-guide.md @@ -54,13 +54,13 @@ Below is a list of tested compilers: #### Linux -* gcc >= 14.0: - * Version 14.x tested using the version in the `manylinux_2_28` container. - * Version 14.x tested using the `musllinux` build with custom compiler. - * Version 14.x tested in CI. -* Clang >= 18.0: - * Version 18.x tested in CI. - * Version 18.x tested in CI with code quality checks. +* gcc >= 16.0: + * Version 16.x tested using the version in the `manylinux_2_28` container. + * Version 16.x tested using the `musllinux` build with custom compiler. + * Version 16.x tested in CI. +* Clang >= 22.0: + * Version 22.x tested in CI. + * Version 22.x tested in CI with code quality checks. ```{Admonition} Additional information Wheel builds for Linux are done inside containers using `cibuildwheel`: @@ -72,10 +72,10 @@ These are handled automatically in CI. For local development, use your system's #### Windows -* MSVC >= 19.0: - * Latest release tested in CI (e.g. Visual Studio 2022, IDE or build tools). -* Clang CL >= 19.0: - * Latest release tested in CI (e.g. Visual Studio 2022, IDE or build tools). +* MSVC >= 19.5.*: + * Latest release tested in CI (e.g. Visual Studio 2026, IDE or build tools). +* Clang CL >= 20.1.8: + * Latest release tested in CI (e.g. Visual Studio 2026, IDE or build tools). #### macOS @@ -85,7 +85,7 @@ These are handled automatically in CI. For local development, use your system's ```{note} Once your compiler of choice is installed, you need to define the environment variables `CC` and `CXX` to specify the compiler. -For example `export CC=clang-18` and `export CXX=clang++-18` to select the `clang` compiler in Ubuntu. +For example `export CC=clang-22` and `export CXX=clang++-22` to select the `clang` compiler in Ubuntu. ``` ### Build System for CMake Project @@ -263,7 +263,7 @@ At the time of writing, the set-up is done as follows: ```shell sudo apt update && sudo apt upgrade # make sure you're up to date -sudo apt install build-essential gcc g++ clang-18 procps curl file git # install initial dependencies +sudo apt install build-essential gcc g++ clang-22 procps curl file git # install initial dependencies ``` Then install Homebrew using the setup recommendations in [Homebrew](https://brew.sh). @@ -281,9 +281,9 @@ brew install \ Append the following lines into the file `${HOME}/.bashrc` (required for `scikit-build` for the Python installation): ```shell -export CXX=clang++ # or g++ or g++-14 or ... -export CC=clang # or gcc or gcc-14 or ... -export LLVM_COV=llvm-cov-18 # only if you want to use one of the llvm features +export CXX=clang++ # or g++ or g++-16 or ... +export CC=clang # or gcc or gcc-16 or ... +export LLVM_COV=llvm-cov-22 # only if you want to use one of the llvm features export CLANG_TIDY=clang-tidy-18 # only if you want to use one of the clang-tidy presets ``` @@ -319,9 +319,9 @@ As a quick start, from the root of the repository: You need to install the MSVC compiler. You can either install the whole Visual Studio IDE or just the build tools. -* [Visual Studio Build Tools](https://aka.ms/vs/17/release/vs_BuildTools.exe) (free) +* [Visual Studio Build Tools](https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2026) (free) * Select C++ build tools -* Full [Visual Studio](https://visualstudio.microsoft.com/vs/) (All three versions are suitable. +* Full [Visual Studio](https://visualstudio.microsoft.com/downloads/) (All three versions are suitable. Check the license!) * Select Desktop Development with C++ * [Optional] Select `C++ Clang tools for Windows` diff --git a/power_grid_model_c/power_grid_model/include/power_grid_model/common/statistics.hpp b/power_grid_model_c/power_grid_model/include/power_grid_model/common/statistics.hpp index 634e1f1506..f60c6ed6ea 100644 --- a/power_grid_model_c/power_grid_model/include/power_grid_model/common/statistics.hpp +++ b/power_grid_model_c/power_grid_model/include/power_grid_model/common/statistics.hpp @@ -248,10 +248,10 @@ template struct PolarComplexRandVar { } }; -template typename RandVarType> - requires std::same_as, UniformComplexRandVar> || - std::same_as, IndependentComplexRandVar> -inline auto conj(RandVarType var) { +template + requires std::same_as> || + std::same_as> +inline auto conj(RandVarType var) { var.value = conj(var.value); return var; } @@ -268,11 +268,12 @@ template inline auto conj(PolarComplexRandVar var) { namespace statistics { // Var(s x) ≈ Var(x) * ||s||^2 -template typename RandVarType> - requires is_in_list_c, UniformRealRandVar, IndependentRealRandVar, - UniformComplexRandVar, IndependentComplexRandVar> -inline auto scale(RandVarType const& var, double scale_factor) { - return RandVarType{.value = var.value * scale_factor, .variance = var.variance * abs2(scale_factor)}; +template + requires is_in_list_c< + RandVarType, UniformRealRandVar, IndependentRealRandVar, + UniformComplexRandVar, IndependentComplexRandVar> +inline auto scale(RandVarType const& var, double scale_factor) { + return RandVarType{.value = var.value * scale_factor, .variance = var.variance * abs2(scale_factor)}; } template @@ -281,10 +282,11 @@ inline auto scale(RandVarType const& var, RealValue const& scale_f return RandVarType{.value = var.value * scale_factor, .variance = var.variance * abs2(scale_factor)}; } -template typename RandVarType> - requires is_in_list_c, UniformComplexRandVar, IndependentComplexRandVar> -inline auto scale(RandVarType const& var, DoubleComplex const& scale_factor) { - return RandVarType{.value = var.value * scale_factor, .variance = var.variance * abs2(scale_factor)}; +template + requires is_in_list_c, + IndependentComplexRandVar> +inline auto scale(RandVarType const& var, DoubleComplex const& scale_factor) { + return RandVarType{.value = var.value * scale_factor, .variance = var.variance * abs2(scale_factor)}; } inline auto scale(IndependentComplexRandVar const& var, ComplexValue const& scale_factor) {