From 13157cb4d612ef0cf3d39cfd34d63e2d5faca94c Mon Sep 17 00:00:00 2001 From: Vincent Rouvreau Date: Mon, 5 Aug 2024 15:48:41 +0200 Subject: [PATCH 1/5] Try continueOnError --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index ebbdef1be9..0b7bae50db 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -46,6 +46,7 @@ jobs: pythonVersion: '3.9' cmakeVcpkgFlags: -DVCPKG_TARGET_TRIPLET=x64-windows -DCMAKE_TOOLCHAIN_FILE=c:\vcpkg\scripts\buildsystems\vcpkg.cmake cmakeFlags: -DWITH_GUDHI_EXAMPLE=ON -DWITH_GUDHI_TEST=ON -DWITH_GUDHI_UTILITIES=ON -DWITH_GUDHI_PYTHON=OFF + continueOnError: false steps: # Use a specific Python version @@ -66,7 +67,6 @@ jobs: choco install -y ninja --force --force-dependencies displayName: 'Install build dependencies' - script: | - $ErrorActionPreference = 'Stop' call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" amd64 mkdir build cd build From fb4e2051ea3e62eb1837821e1cd84f9a60c0a088 Mon Sep 17 00:00:00 2001 From: Vincent Rouvreau Date: Fri, 23 Aug 2024 16:23:34 +0200 Subject: [PATCH 2/5] Try to test error level --- azure-pipelines.yml | 135 ++++++++++++++++++++++++-------------------- 1 file changed, 73 insertions(+), 62 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 0b7bae50db..dca19be29a 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -1,85 +1,96 @@ jobs: - - - job: 'OSx' + - job: "OSx" displayName: "Build and test OSx" timeoutInMinutes: 0 cancelTimeoutInMinutes: 60 pool: vmImage: macOS-latest variables: - pythonVersion: '3.9' + pythonVersion: "3.9" cmakeBuildType: Release steps: - # Use a specific Python version - - task: UsePythonVersion@0 - displayName: Use Python $(pythonVersion) - inputs: - versionSpec: $(pythonVersion) - addToPath: true - architecture: 'x64' + # Use a specific Python version + - task: UsePythonVersion@0 + displayName: Use Python $(pythonVersion) + inputs: + versionSpec: $(pythonVersion) + addToPath: true + architecture: "x64" - - bash: | - git submodule update --init - python -m pip install --user -r ext/gudhi-deploy/build-requirements.txt - python -m pip install --user -r ext/gudhi-deploy/test-requirements.txt - python -m pip uninstall -y pykeops - brew update || true - brew install ninja graphviz doxygen boost eigen gmp mpfr tbb cgal || true - displayName: 'Install build dependencies' - - bash: | - mkdir build - cd build - cmake -DCMAKE_BUILD_TYPE:STRING=$(cmakeBuildType) -GNinja -DWITH_GUDHI_EXAMPLE=ON -DWITH_GUDHI_TEST=ON -DWITH_GUDHI_UTILITIES=ON -DWITH_GUDHI_PYTHON=ON -DWITH_GUDHI_REMOTE_TEST=ON .. - ninja - ninja doxygen - ctest --output-on-failure - displayName: 'Build, test and documentation generation' + - bash: | + git submodule update --init + python -m pip install --user -r ext/gudhi-deploy/build-requirements.txt + python -m pip install --user -r ext/gudhi-deploy/test-requirements.txt + python -m pip uninstall -y pykeops + brew update || true + brew install ninja graphviz doxygen boost eigen gmp mpfr tbb cgal || true + displayName: "Install build dependencies" + - bash: | + mkdir build + cd build + cmake -DCMAKE_BUILD_TYPE:STRING=$(cmakeBuildType) -GNinja -DWITH_GUDHI_EXAMPLE=ON -DWITH_GUDHI_TEST=ON -DWITH_GUDHI_UTILITIES=ON -DWITH_GUDHI_PYTHON=ON -DWITH_GUDHI_REMOTE_TEST=ON .. + ninja + ninja doxygen + ctest --output-on-failure + displayName: "Build, test and documentation generation" - - job: 'Windows' + - job: "Windows" displayName: "Build and test Windows" timeoutInMinutes: 0 cancelTimeoutInMinutes: 60 pool: vmImage: windows-latest variables: - pythonVersion: '3.9' + pythonVersion: "3.9" cmakeVcpkgFlags: -DVCPKG_TARGET_TRIPLET=x64-windows -DCMAKE_TOOLCHAIN_FILE=c:\vcpkg\scripts\buildsystems\vcpkg.cmake cmakeFlags: -DWITH_GUDHI_EXAMPLE=ON -DWITH_GUDHI_TEST=ON -DWITH_GUDHI_UTILITIES=ON -DWITH_GUDHI_PYTHON=OFF - continueOnError: false steps: - # Use a specific Python version - - task: UsePythonVersion@0 - displayName: Use Python $(pythonVersion) - inputs: - versionSpec: $(pythonVersion) - addToPath: true - architecture: 'x64' + # Use a specific Python version + - task: UsePythonVersion@0 + displayName: Use Python $(pythonVersion) + inputs: + versionSpec: $(pythonVersion) + addToPath: true + architecture: "x64" - - script: | - git submodule update --init - python -m pip install --user -r ext/gudhi-deploy/build-requirements.txt - python -m pip install --user -r ext/gudhi-deploy/test-requirements.txt - # Only vcpkg release libs for CI - echo.set(VCPKG_BUILD_TYPE release)>> C:\vcpkg\triplets\x64-windows.cmake - vcpkg install boost-filesystem:x64-windows boost-test:x64-windows boost-program-options:x64-windows tbb:x64-windows eigen3:x64-windows cgal:x64-windows - choco install -y ninja --force --force-dependencies - displayName: 'Install build dependencies' - - script: | - call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" amd64 - mkdir build - cd build - cmake -DCMAKE_BUILD_TYPE=Release -G "Ninja" -DFORCE_EIGEN_DEFAULT_DENSE_INDEX_TYPE_TO_INT=ON $(cmakeVcpkgFlags) $(cmakeFlags) .. - ninja - ctest --output-on-failure -C Release -E diff_files - cmake -DWITH_GUDHI_PYTHON=ON -DWITH_GUDHI_REMOTE_TEST=ON . - cd src\python - copy "C:\vcpkg\installed\x64-windows\bin\mpfr*.dll" ".\gudhi\" - copy "C:\vcpkg\installed\x64-windows\bin\gmp*.dll" ".\gudhi\" - copy "C:\vcpkg\installed\x64-windows\bin\tbb*.dll" ".\gudhi\" - python setup.py build_ext --inplace - SET PYTHONPATH=%CD%;%PYTHONPATH% - echo %PYTHONPATH% - ctest --output-on-failure -C Release - displayName: 'Build and test' + - script: | + git submodule update --init + python -m pip install --user -r ext/gudhi-deploy/build-requirements.txt + IF %ERRORLEVEL% NEQ 0 EXIT 1 + python -m pip install --user -r ext/gudhi-deploy/test-requirements.txt + IF %ERRORLEVEL% NEQ 0 EXIT 1 + # Only vcpkg release libs for CI + echo.set(VCPKG_BUILD_TYPE release)>> C:\vcpkg\triplets\x64-windows.cmake + vcpkg install boost-filesystem:x64-windows boost-test:x64-windows boost-program-options:x64-windows tbb:x64-windows eigen3:x64-windows cgal:x64-windows + IF %ERRORLEVEL% NEQ 0 EXIT 1 + choco install -y ninja --force --force-dependencies + IF %ERRORLEVEL% NEQ 0 EXIT 1 + displayName: "Install build dependencies" + - script: | + call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" amd64 + mkdir build + cd build + cmake -DCMAKE_BUILD_TYPE=Release -G "Ninja" -DFORCE_EIGEN_DEFAULT_DENSE_INDEX_TYPE_TO_INT=ON $(cmakeVcpkgFlags) $(cmakeFlags) .. + IF %ERRORLEVEL% NEQ 0 EXIT 1 + ninja + IF %ERRORLEVEL% NEQ 0 EXIT 1 + ctest --output-on-failure -C Release -E diff_files + IF %ERRORLEVEL% NEQ 0 EXIT 1 + cmake -DWITH_GUDHI_PYTHON=ON -DWITH_GUDHI_REMOTE_TEST=ON . + IF %ERRORLEVEL% NEQ 0 EXIT 1 + cd src\python + copy "C:\vcpkg\installed\x64-windows\bin\mpfr*.dll" ".\gudhi\" + IF %ERRORLEVEL% NEQ 0 EXIT 1 + copy "C:\vcpkg\installed\x64-windows\bin\gmp*.dll" ".\gudhi\" + IF %ERRORLEVEL% NEQ 0 EXIT 1 + copy "C:\vcpkg\installed\x64-windows\bin\tbb*.dll" ".\gudhi\" + IF %ERRORLEVEL% NEQ 0 EXIT 1 + python setup.py build_ext --inplace + IF %ERRORLEVEL% NEQ 0 EXIT 1 + SET PYTHONPATH=%CD%;%PYTHONPATH% + echo %PYTHONPATH% + ctest --output-on-failure -C Release + IF %ERRORLEVEL% NEQ 0 EXIT 1 + displayName: "Build and test" From 82b07d2ed5a004b3f4dc923d83beaabaeb0b52a1 Mon Sep 17 00:00:00 2001 From: hschreiber Date: Mon, 26 Aug 2024 12:10:19 +0200 Subject: [PATCH 3/5] fix of structural binding bug in windows compiler --- .../include/gudhi/persistence_interval.h | 174 ++++++++++-------- 1 file changed, 99 insertions(+), 75 deletions(-) diff --git a/src/Persistence_matrix/include/gudhi/persistence_interval.h b/src/Persistence_matrix/include/gudhi/persistence_interval.h index b1b1528131..8504d0e943 100644 --- a/src/Persistence_matrix/include/gudhi/persistence_interval.h +++ b/src/Persistence_matrix/include/gudhi/persistence_interval.h @@ -88,140 +88,164 @@ struct Persistence_interval { } return stream; } + + /** + * @brief Specialization of `get` for @ref Gudhi::persistence_matrix::Persistence_interval. + * + * @tparam I Index of the value to return: 0 for the birth value, 1 for the death value and 2 for the dimension. + * @return Either the birth value if @p I == 0, the death value if @p I == 1 or the dimension if @p I == 2. + */ + template + constexpr auto& get() & noexcept { + static_assert(I < 3, "Value mismatch at argument 1 in template parameter list. Maximal possible value is 2."); + + if constexpr (I == 0) return birth; + if constexpr (I == 1) return death; + if constexpr (I == 2) return dim; + } + + /** + * @brief Specialization of `get` for @ref Gudhi::persistence_matrix::Persistence_interval. + * + * @tparam I Index of the value to return: 0 for the birth value, 1 for the death value and 2 for the dimension. + * @return Either the birth value if @p I == 0, the death value if @p I == 1 or the dimension if @p I == 2. + */ + template + constexpr const auto& get() const& noexcept { + static_assert(I < 3, "Value mismatch at argument 1 in template parameter list. Maximal possible value is 2."); + + if constexpr (I == 0) return birth; + if constexpr (I == 1) return death; + if constexpr (I == 2) return dim; + } + + /** + * @brief Specialization of `get` for @ref Gudhi::persistence_matrix::Persistence_interval. + * + * @tparam I Index of the value to return: 0 for the birth value, 1 for the death value and 2 for the dimension. + * @return Either the birth value if @p I == 0, the death value if @p I == 1 or the dimension if @p I == 2. + */ + template + constexpr auto&& get() && noexcept { + static_assert(I < 3, "Value mismatch at argument 1 in template parameter list. Maximal possible value is 2."); + + if constexpr (I == 0) return std::move(birth); + if constexpr (I == 1) return std::move(death); + if constexpr (I == 2) return std::move(dim); + } + + /** + * @brief Specialization of `get` for @ref Gudhi::persistence_matrix::Persistence_interval. + * + * @tparam I Index of the value to return: 0 for the birth value, 1 for the death value and 2 for the dimension. + * @return Either the birth value if @p I == 0, the death value if @p I == 1 or the dimension if @p I == 2. + */ + template + constexpr const auto&& get() const&& noexcept { + static_assert(I < 3, "Value mismatch at argument 1 in template parameter list. Maximal possible value is 2."); + + if constexpr (I == 0) return std::move(birth); + if constexpr (I == 1) return std::move(death); + if constexpr (I == 2) return std::move(dim); + } }; +} // namespace persistence_matrix +} // namespace Gudhi + +namespace std { + /** * @ingroup persistence_matrix * - * @brief Partial specialization of `get` for @ref Gudhi::persistence_matrix::Persistence_interval. + * @brief Partial specialization of `std::tuple_size` for @ref Gudhi::persistence_matrix::Persistence_interval. * - * @tparam I Index of the value to return: 0 for the birth value, 1 for the death value and 2 for the dimension. * @tparam Dimension First template parameter of @ref Gudhi::persistence_matrix::Persistence_interval. * @tparam Event_value Second template parameter of @ref Gudhi::persistence_matrix::Persistence_interval. - * @param i Interval from which the value should be returned. - * @return Either the birth value if @p I == 0, the death value if @p I == 1 or the dimension if @p I == 2. */ -template -constexpr auto& get(Gudhi::persistence_matrix::Persistence_interval& i) noexcept { - static_assert(I < 3, "Value mismatch at argument 1 in template parameter list. Maximal possible value is 2."); - - if constexpr (I == 0) return i.birth; - if constexpr (I == 1) return i.death; - if constexpr (I == 2) return i.dim; -} +template +struct tuple_size > + : integral_constant {}; /** * @ingroup persistence_matrix * - * @brief Partial specialization of `get` for @ref Gudhi::persistence_matrix::Persistence_interval. + * @brief Partial specialization of `std::tuple_element` for @ref Gudhi::persistence_matrix::Persistence_interval. * - * @tparam I Index of the value to return: 0 for the birth value, 1 for the death value and 2 for the dimension. + * @tparam I Index of the type to store: 0 for the birth value type, 1 for the death value type and 2 for the + * dimension value type. * @tparam Dimension First template parameter of @ref Gudhi::persistence_matrix::Persistence_interval. * @tparam Event_value Second template parameter of @ref Gudhi::persistence_matrix::Persistence_interval. - * @param i Interval from which the value should be returned. - * @return Either the birth value if @p I == 0, the death value if @p I == 1 or the dimension if @p I == 2. */ -template -constexpr const auto& get(const Gudhi::persistence_matrix::Persistence_interval& i) noexcept { +template +struct tuple_element > { static_assert(I < 3, "Value mismatch at argument 1 in template parameter list. Maximal possible value is 2."); - if constexpr (I == 0) return i.birth; - if constexpr (I == 1) return i.death; - if constexpr (I == 2) return i.dim; -} + using type = typename conditional ::type; +}; /** * @ingroup persistence_matrix * * @brief Partial specialization of `get` for @ref Gudhi::persistence_matrix::Persistence_interval. - * + * * @tparam I Index of the value to return: 0 for the birth value, 1 for the death value and 2 for the dimension. * @tparam Dimension First template parameter of @ref Gudhi::persistence_matrix::Persistence_interval. * @tparam Event_value Second template parameter of @ref Gudhi::persistence_matrix::Persistence_interval. * @param i Interval from which the value should be returned. * @return Either the birth value if @p I == 0, the death value if @p I == 1 or the dimension if @p I == 2. */ -template -constexpr auto&& get(Gudhi::persistence_matrix::Persistence_interval&& i) noexcept { - static_assert(I < 3, "Value mismatch at argument 1 in template parameter list. Maximal possible value is 2."); - - if constexpr (I == 0) return std::move(i.birth); - if constexpr (I == 1) return std::move(i.death); - if constexpr (I == 2) return std::move(i.dim); +template +constexpr auto& get(Gudhi::persistence_matrix::Persistence_interval& i) noexcept { + return i.template get(); } /** * @ingroup persistence_matrix * * @brief Partial specialization of `get` for @ref Gudhi::persistence_matrix::Persistence_interval. - * + * * @tparam I Index of the value to return: 0 for the birth value, 1 for the death value and 2 for the dimension. * @tparam Dimension First template parameter of @ref Gudhi::persistence_matrix::Persistence_interval. * @tparam Event_value Second template parameter of @ref Gudhi::persistence_matrix::Persistence_interval. * @param i Interval from which the value should be returned. * @return Either the birth value if @p I == 0, the death value if @p I == 1 or the dimension if @p I == 2. */ -template -constexpr const auto&& get(const Gudhi::persistence_matrix::Persistence_interval&& i) noexcept { - static_assert(I < 3, "Value mismatch at argument 1 in template parameter list. Maximal possible value is 2."); - - if constexpr (I == 0) return std::move(i.birth); - if constexpr (I == 1) return std::move(i.death); - if constexpr (I == 2) return std::move(i.dim); +template +constexpr const auto& get(const Gudhi::persistence_matrix::Persistence_interval& i) noexcept { + return i.template get(); } -} // namespace persistence_matrix -} // namespace Gudhi - -namespace std { - /** * @ingroup persistence_matrix * - * @brief Partial specialization of `std::tuple_size` for @ref Gudhi::persistence_matrix::Persistence_interval. - * + * @brief Partial specialization of `get` for @ref Gudhi::persistence_matrix::Persistence_interval. + * + * @tparam I Index of the value to return: 0 for the birth value, 1 for the death value and 2 for the dimension. * @tparam Dimension First template parameter of @ref Gudhi::persistence_matrix::Persistence_interval. * @tparam Event_value Second template parameter of @ref Gudhi::persistence_matrix::Persistence_interval. + * @param i Interval from which the value should be returned. + * @return Either the birth value if @p I == 0, the death value if @p I == 1 or the dimension if @p I == 2. */ -template -struct tuple_size > - : integral_constant {}; +template +constexpr auto&& get(Gudhi::persistence_matrix::Persistence_interval&& i) noexcept { + return std::move(i.template get()); +} /** * @ingroup persistence_matrix * - * @brief Partial specialization of `std::tuple_element` for @ref Gudhi::persistence_matrix::Persistence_interval. - * - * @tparam I Index of the type to store: 0 for the birth value type, 1 for the death value type and 2 for the - * dimension value type. + * @brief Partial specialization of `get` for @ref Gudhi::persistence_matrix::Persistence_interval. + * + * @tparam I Index of the value to return: 0 for the birth value, 1 for the death value and 2 for the dimension. * @tparam Dimension First template parameter of @ref Gudhi::persistence_matrix::Persistence_interval. * @tparam Event_value Second template parameter of @ref Gudhi::persistence_matrix::Persistence_interval. + * @param i Interval from which the value should be returned. + * @return Either the birth value if @p I == 0, the death value if @p I == 1 or the dimension if @p I == 2. */ -template -struct tuple_element > { - static_assert(I < 3, "Value mismatch at argument 1 in template parameter list. Maximal possible value is 2."); - - using type = typename conditional ::type; -}; - -template -constexpr auto& get(Gudhi::persistence_matrix::Persistence_interval& i) noexcept { - return Gudhi::persistence_matrix::get(i); -} - -template -constexpr const auto& get(const Gudhi::persistence_matrix::Persistence_interval& i) noexcept { - return Gudhi::persistence_matrix::get(i); -} - -template -constexpr auto&& get(Gudhi::persistence_matrix::Persistence_interval&& i) noexcept { - return Gudhi::persistence_matrix::get(move(i)); -} - template constexpr const auto&& get(const Gudhi::persistence_matrix::Persistence_interval&& i) noexcept { - return Gudhi::persistence_matrix::get(move(i)); + return std::move(i.template get()); } } // namespace std From 1c7e1e99594299b23e1d45516d4d44d397584c5d Mon Sep 17 00:00:00 2001 From: hschreiber <48448038+hschreiber@users.noreply.github.com> Date: Mon, 26 Aug 2024 13:50:09 +0200 Subject: [PATCH 4/5] Update src/Persistence_matrix/include/gudhi/persistence_interval.h Co-authored-by: Marc Glisse --- src/Persistence_matrix/include/gudhi/persistence_interval.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Persistence_matrix/include/gudhi/persistence_interval.h b/src/Persistence_matrix/include/gudhi/persistence_interval.h index 8504d0e943..eed706327a 100644 --- a/src/Persistence_matrix/include/gudhi/persistence_interval.h +++ b/src/Persistence_matrix/include/gudhi/persistence_interval.h @@ -229,7 +229,7 @@ constexpr const auto& get(const Gudhi::persistence_matrix::Persistence_interval< */ template constexpr auto&& get(Gudhi::persistence_matrix::Persistence_interval&& i) noexcept { - return std::move(i.template get()); + return std::move(i).template get(); } /** From a6550ac7f6f75eaec1f666aefffeeb2ded837c43 Mon Sep 17 00:00:00 2001 From: hschreiber <48448038+hschreiber@users.noreply.github.com> Date: Mon, 26 Aug 2024 14:01:45 +0200 Subject: [PATCH 5/5] Update persistence_interval.h --- src/Persistence_matrix/include/gudhi/persistence_interval.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Persistence_matrix/include/gudhi/persistence_interval.h b/src/Persistence_matrix/include/gudhi/persistence_interval.h index eed706327a..d72cabdad6 100644 --- a/src/Persistence_matrix/include/gudhi/persistence_interval.h +++ b/src/Persistence_matrix/include/gudhi/persistence_interval.h @@ -245,7 +245,7 @@ constexpr auto&& get(Gudhi::persistence_matrix::Persistence_interval constexpr const auto&& get(const Gudhi::persistence_matrix::Persistence_interval&& i) noexcept { - return std::move(i.template get()); + return std::move(i).template get(); } } // namespace std