diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 53fc342435..fed4c6c2b7 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -1,34 +1,16 @@ name: check_code on: - push: - # triggered on tag pushes with tags beginning with either "v" or "dev" - branch-ignore: - - '*' - tags: - - 'v*' - - 'dev*' - - 'ci*' - - 'check*' - pull_request: - # also triggered by pull requests on the "dev" & "mpi" branches - branches: - - 'dev' - - 'mpi' - - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true + workflow_call: + workflow_dispatch: env: - PV_TAG: v5.13.0-headless + PV_TAG: v6.0.1-headless PV_REPO: topology-tool-kit/ttk-paraview jobs: - # ----------------------- # # Check source formatting # # ----------------------- # @@ -177,7 +159,7 @@ jobs: # Check compiler warnings # # ----------------------- # check-warnings: - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 strategy: matrix: kamikaze: [KAMIKAZE=TRUE, KAMIKAZE=FALSE] @@ -219,7 +201,7 @@ jobs: - name: Fetch TTK-ParaView headless Debian package run: | wget -O ttk-paraview-headless.deb \ - https://github.com/${{ env.PV_REPO }}/releases/download/${{ env.PV_TAG }}/ttk-paraview-headless-ubuntu-22.04.deb + https://github.com/${{ env.PV_REPO }}/releases/download/${{ env.PV_TAG }}/ttk-paraview-headless-ubuntu-24.04.deb - name: Install ParaView .deb run: | diff --git a/.github/workflows/test-macos.yml b/.github/workflows/test-macos.yml new file mode 100644 index 0000000000..0f2fa30bb3 --- /dev/null +++ b/.github/workflows/test-macos.yml @@ -0,0 +1,160 @@ +name: test_build-macos + +on: + workflow_call: + workflow_dispatch: + +env: + PV_TAG: v6.0.1-headless + PV_REPO: topology-tool-kit/ttk-paraview + CMAKE_GENERATOR: Ninja + CMAKE_BUILD_TYPE: Release + CMAKE_CC_COMPILER_LAUNCHER: sccache + CMAKE_CXX_COMPILER_LAUNCHER: sccache + SCCACHE_GHA_ENABLED: "true" + SCCACHE_IDLE_TIMEOUT: 0 + + +jobs: + + # -----------------# + # Test macOS build # + # -----------------# + test-build: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [macos-14, macos-15] + env: + DYLD_LIBRARY_PATH: /usr/local/lib + + steps: + - uses: actions/checkout@v4 + name: Checkout TTK source code + + - uses: actions/setup-python@v5 + with: + python-version: '3.13' + + - name: Install macOS dependencies + run: | + # ParaView dependencies + brew install --cask xquartz + brew install ninja open-mpi libomp + # TTK dependencies + brew install boost cgal eigen graphviz spectra sqlite numpy qhull + + - name: Run sccache-cache + uses: mozilla-actions/sccache-action@v0.0.9 + + - name: Install optional Spectra dependency + uses: ./.github/actions/install-spectra-unix + + - name: Install optional ZFP dependency + uses: ./.github/actions/install-zfp-unix + + - name: Fetch TTK-ParaView headless macOS binary archive + run: | + wget -O ttk-paraview-headless.tar.gz \ + https://github.com/${{ env.PV_REPO }}/releases/download/${{ env.PV_TAG }}/ttk-paraview-headless-${{ matrix.os }}.tar.gz + + - name: Install ParaView + run: | + tar xzf ttk-paraview-headless.tar.gz + sudo cp -r ttk-paraview/* /usr/local + # pvpython does not embed the correct PYTHONPATH + echo "PYTHONPATH=/usr/local/lib/python3.13/site-packages:$PYTHONPATH" >> $GITHUB_ENV + pvpython -m pip install --break-system-packages scikit-learn + # pvpython is expecting a vtkpython executable at this path + sudo ln -s /usr/local/bin/pvpython /Library/Frameworks/Python.framework/Versions/3.13/vtkpython + + - name: Create & configure TTK build directory + run: | + mkdir build + cd build + cmake \ + -DCMAKE_COMPILE_WARNING_AS_ERROR=ON \ + -DOpenMP_C_FLAGS="-Xpreprocessor -fopenmp -I/opt/homebrew/opt/libomp/include" \ + -DOpenMP_C_LIB_NAMES="omp" \ + -DOpenMP_CXX_FLAGS="-Xpreprocessor -fopenmp -I/opt/homebrew/opt/libomp/include" \ + -DOpenMP_CXX_LIB_NAMES="omp" \ + -DOpenMP_omp_LIBRARY=/opt/homebrew/opt/libomp/lib/libomp.dylib \ + -DCMAKE_EXE_LINKER_FLAGS="-L/opt/homebrew/opt/libomp/lib -lomp" \ + -DTTK_BUILD_PARAVIEW_PLUGINS=TRUE \ + -DTTK_BUILD_VTK_WRAPPERS=TRUE \ + -DTTK_BUILD_STANDALONE_APPS=TRUE \ + -DTTK_ENABLE_KAMIKAZE=TRUE \ + -DTTK_ENABLE_MPI=FALSE \ + -DTTK_ENABLE_CPU_OPTIMIZATION=FALSE \ + -DTTK_ENABLE_SHARED_BASE_LIBRARIES=TRUE \ + -DTTK_IMPLICIT_PRECONDITIONS_THRESHOLD=64*64*64 \ + $GITHUB_WORKSPACE + + - uses: ammaraskar/gcc-problem-matcher@master + - name: Build & install TTK + run: | + cd build + cmake --build . --parallel + sudo cmake --build . --target install + + - name: Run TTK tests + uses: ./.github/actions/test-ttk-macos + + - uses: actions/checkout@v4 + with: + repository: "topology-tool-kit/ttk-data" + ref: "dev" + path: "ttk-data" + name: Checkout ttk-data + + - name: Run ttk-data states [NOT ENFORCED] + id: validate + continue-on-error: true + run: | + # remove buggy example + # related issue: https://github.com/topology-tool-kit/ttk/issues/1055 + rm ttk-data/states/nestedTrackingFromOverlap.py + # remove examples which fill up the memory + rm ttk-data/states/topologicalOptimization_darkSky.pvsm + # remove examples that take too long to render under mac + rm ttk-data/states/cosmicWeb.pvsm + rm ttk-data/states/persistenceClusteringGallery.pvsm + rm ttk-data/states/persistentGenerators_householdAnalysis.pvsm + rm ttk-data/states/topologicalOptimization*.pvsm + cd ttk-data/tests + mkdir output_screenshots + pvpython -u validate.py || (tar zcf screenshots.tar.gz output_screenshots && false) + env: + PV_PLUGIN_PATH: /usr/local/bin/plugins/TopologyToolKit + + - name: Upload result screenshots + if: steps.validate.outcome == 'failure' + uses: actions/upload-artifact@v4 + with: + name: screenshots-${{ matrix.os }}.tar.gz + path: ttk-data/tests/screenshots.tar.gz + retention-days: 10 + + - name: Run ttk-data Python scripts + run: | + cd ttk-data + # remove buggy example + # related issue: https://github.com/topology-tool-kit/ttk/issues/1055 + rm python/nestedTrackingFromOverlap.py + # tmp removal of mpi example + rm python/mpiExample.py + rm python/distributedPersistenceDiagram.py + # remove examples which fill up the memory + rm python/topologicalOptimization_darkSky.py + # remove sklearn examples -- buggy on MacOS since sklearn-1.7 + rm python/1manifoldLearning.py python/clusteringKelvinHelmholtzInstabilities.py python/karhunenLoveDigits64Dimensions.py python/mergeTreeClustering.py python/persistentGenerators_householdAnalysis.py python/persistentGenerators_periodicPicture.py + pvpython -u python/run.py + env: + PV_PLUGIN_PATH: /usr/local/bin/plugins/TopologyToolKit + + - name: Test ttk-data Python scripts results [NOT ENFORCED] + continue-on-error: true + run: | + cd ttk-data + cat python/res.json + diff python/hashes/macOS.json python/res.json diff --git a/.github/workflows/test-ubuntu.yml b/.github/workflows/test-ubuntu.yml new file mode 100644 index 0000000000..9267dbd4c7 --- /dev/null +++ b/.github/workflows/test-ubuntu.yml @@ -0,0 +1,240 @@ +name: test_build-ubuntu + +on: + workflow_call: + workflow_dispatch: + +env: + PV_TAG: v6.0.1-headless + PV_REPO: topology-tool-kit/ttk-paraview + CMAKE_GENERATOR: Ninja + CMAKE_BUILD_TYPE: Release + CMAKE_CC_COMPILER_LAUNCHER: sccache + CMAKE_CXX_COMPILER_LAUNCHER: sccache + SCCACHE_GHA_ENABLED: "true" + SCCACHE_IDLE_TIMEOUT: 0 + + +jobs: + + # ------------------# + # Test Ubuntu build # + # ------------------# + test-build: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-22.04, ubuntu-24.04] + + steps: + - uses: actions/checkout@v4 + name: Checkout TTK source code + + - name: Install Ubuntu dependencies + run: | + sudo apt update + # TTK dependencies + sudo apt install -y \ + libboost-system-dev \ + libcgal-dev \ + libeigen3-dev \ + libgraphviz-dev \ + libosmesa-dev \ + libopenmpi-dev \ + libsqlite3-dev \ + libwebsocketpp-dev \ + graphviz \ + python3-sklearn \ + ninja-build \ + zlib1g-dev \ + libqhull-dev \ + dpkg-dev + + - name: Run sccache-cache + uses: mozilla-actions/sccache-action@v0.0.9 + + - name: Install optional Spectra dependency + uses: ./.github/actions/install-spectra-unix + + - name: Install optional ZFP dependency + uses: ./.github/actions/install-zfp-unix + + # TODO: try to replicate for mac + - name: Install Torch + shell: bash + run: | + wget https://download.pytorch.org/libtorch/cpu/libtorch-cxx11-abi-shared-with-deps-2.3.1%2Bcpu.zip + unzip libtorch-cxx11-abi-shared-with-deps-2.3.1+cpu.zip + sudo cp -R libtorch/* /usr/local/ + + - name: Fetch TTK-ParaView headless Debian package + run: | + wget -O ttk-paraview-headless.deb \ + https://github.com/${{ env.PV_REPO }}/releases/download/${{ env.PV_TAG }}/ttk-paraview-headless-${{ matrix.os }}.deb + + - name: Install ParaView .deb + run: | + sudo apt install ./ttk-paraview-headless.deb + + - name: Create & configure TTK build directory + run: | + mkdir build + cd build + cmake \ + -DCMAKE_COMPILE_WARNING_AS_ERROR=ON \ + -DCMAKE_INSTALL_PREFIX=/usr \ + -DTTK_BUILD_PARAVIEW_PLUGINS=TRUE \ + -DTTK_BUILD_VTK_WRAPPERS=TRUE \ + -DTTK_BUILD_STANDALONE_APPS=TRUE \ + -DTTK_ENABLE_KAMIKAZE=TRUE \ + -DTTK_ENABLE_MPI=TRUE \ + -DTTK_ENABLE_CPU_OPTIMIZATION=FALSE \ + -DTTK_ENABLE_SHARED_BASE_LIBRARIES=TRUE \ + -DTTK_IMPLICIT_PRECONDITIONS_THRESHOLD=64*64*64 \ + $GITHUB_WORKSPACE + + - uses: ammaraskar/gcc-problem-matcher@master + - name: Build, install TTK & package it + run: | + cd build + cmake --build . --parallel + cpack -G DEB + sudo cmake --build . --target install + + - name: Run TTK tests + uses: ./.github/actions/test-ttk-ubuntu + + - name: Upload TTK .deb package for fast install in tests + uses: actions/upload-artifact@v4 + with: + name: ttk-for-tests-${{ matrix.os }}.deb + path: build/ttk.deb + + # ------------------# + # Tests on ttk-data # + # ------------------# + run-python-screenshots-tests: + runs-on: ${{ matrix.os }} + needs: test-build + strategy: + matrix: + os: [ubuntu-22.04, ubuntu-24.04] + testSet: [pyTests, screenshotTests] + steps: + - name: Install Ubuntu dependencies + run: | + sudo apt update + + - name: Install Torch + shell: bash + run: | + wget https://download.pytorch.org/libtorch/cpu/libtorch-cxx11-abi-shared-with-deps-2.3.1%2Bcpu.zip + unzip libtorch-cxx11-abi-shared-with-deps-2.3.1+cpu.zip + sudo cp -R libtorch/* /usr/local/ + + - name: Fetch TTK-ParaView headless Debian package + run: | + wget -O ttk-paraview-headless.deb \ + https://github.com/${{ env.PV_REPO }}/releases/download/${{ env.PV_TAG }}/ttk-paraview-headless-${{ matrix.os }}.deb + + - name: Install ParaView .deb + run: | + sudo apt install ./ttk-paraview-headless.deb + + - name: Fetch TTK packages we just built in the test-build-ubuntu job + uses: actions/download-artifact@v4.1.7 + with: + name: ttk-for-tests-${{ matrix.os }}.deb + + - name: Installing the previously built ttk package + run: | + sudo apt install ./ttk.deb + + - uses: actions/checkout@v4 + with: + repository: "topology-tool-kit/ttk-data" + ref: "dev" + path: "ttk-data" + name: Checkout ttk-data + + - name: Resample large datasets + shell: python3 {0} + working-directory: ./ttk-data + run: | + from paraview import simple + for ds in ["ctBones.vti"]: + vti = simple.XMLImageDataReader(FileName=ds) + rsi = simple.ResampleToImage(Input=vti) + rsi.SamplingDimensions = [128, 128, 128] + simple.SaveData(ds, rsi) + + - name: Run ttk-data states [NOT ENFORCED] + if: matrix.testSet == 'screenshotTests' + id: validate + continue-on-error: true + run: | + VERS=$(hostnamectl | grep "Operating System") + # Ubuntu 22.04 OOM killer also kills the parent process... + if [[ "$VERS" == *"22.04"* ]] || [[ "$VERS" == *"24.04"* ]]; then + rm ttk-data/states/mergeTreeClustering.pvsm + rm ttk-data/states/mergeTreePGA.pvsm + rm ttk-data/states/mergeTreeTemporalReduction.pvsm + rm ttk-data/states/persistentGenerators_darkSky.pvsm + fi + # remove buggy example + # related issue: https://github.com/topology-tool-kit/ttk/issues/1055 + rm ttk-data/states/nestedTrackingFromOverlap.py + # remove examples which fill up the memory + rm ttk-data/states/topologicalOptimization_darkSky.pvsm + rm ttk-data/states/topologicalOptimization*.pvsm + + cd ttk-data/tests + mkdir output_screenshots + if ! python3 -u validate.py; then + + if [[ "$VERS" == *"22.04"* ]] || [[ "$VERS" == *"24.04"* ]]; then + # weird opacity difference between the two Ubuntus + rm -f output_screenshots/clusteringKelvinHelmholtzInstabilities_1.png + rm -f output_screenshots/clusteringKelvinHelmholtzInstabilities_2.png + fi + if [ "$(ls -A output_screenshots)" ]; then + tar zcf screenshots.tar.gz output_screenshots + false + fi + fi + + - name: Upload result screenshots + if: steps.validate.outcome == 'failure' && matrix.testSet == 'screenshotTests' + uses: actions/upload-artifact@v4 + with: + name: screenshots-${{ matrix.os }}.tar.gz + path: ttk-data/tests/screenshots.tar.gz + retention-days: 10 + + - name: Run ttk-data Python scripts + if: matrix.testSet == 'pyTests' + run: | + cd ttk-data + # remove buggy example + # related issue: https://github.com/topology-tool-kit/ttk/issues/1055 + rm python/nestedTrackingFromOverlap.py + # tmp removal of mpi example + rm python/mpiExample.py + # remove examples which fill up the memory + rm python/topologicalOptimization_darkSky.py + pvpython -u python/run.py + + - name: Test ttk-data Python scripts results [NOT ENFORCED] + if: matrix.testSet == 'pyTests' + continue-on-error: true + run: | + cd ttk-data + cat python/res.json + diff python/hashes/${{ matrix.os }}.json python/res.json + + - name: Delete TTK package artifact + uses: geekyeggo/delete-artifact@v5 + # delete package only once + if: matrix.testSet == 'screenshotTests' + with: + name: ttk-for-tests-${{ matrix.os }}.deb diff --git a/.github/workflows/test-windows.yml b/.github/workflows/test-windows.yml new file mode 100644 index 0000000000..2f56cb4e4d --- /dev/null +++ b/.github/workflows/test-windows.yml @@ -0,0 +1,192 @@ +name: test_build-windows + +on: + workflow_call: + workflow_dispatch: + +env: + PV_TAG: v6.0.1-headless + PV_REPO: topology-tool-kit/ttk-paraview + PV_DIR: C:\Program Files\TTK-ParaView + TTK_DIR: C:\Program Files (x86)\ttk + CONDA_ROOT: C:\Miniconda + CC: clang-cl.exe + CXX: clang-cl.exe + CMAKE_GENERATOR: Ninja + CMAKE_BUILD_TYPE: Release + CMAKE_CC_COMPILER_LAUNCHER: sccache + CMAKE_CXX_COMPILER_LAUNCHER: sccache + SCCACHE_GHA_ENABLED: "true" + SCCACHE_IDLE_TIMEOUT: 0 + + +jobs: + + # ------------------ # + # Test Windows build # + # ------------------ # + test-build: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [windows-2022] + + steps: + - uses: actions/checkout@v4 + name: Checkout TTK source code + + - uses: s-weigand/setup-conda@v1 + + - name: Install dependencies with conda + shell: bash + run: | + conda install -c conda-forge libboost-devel glew eigen spectralib zfp \ + sqlite scikit-learn graphviz ninja python=3.10 zlib qhull \ + llvm-openmp clangxx=18 + # add TTK & ParaView install folders to PATH + echo "$PV_DIR/bin" >> $GITHUB_PATH + echo "$TTK_DIR/bin" >> $GITHUB_PATH + conda info --all + + - name: Run sccache-cache + uses: mozilla-actions/sccache-action@v0.0.9 + + - name: Remove hosted Python + shell: bash + run: | + rm -rf C:/hostedtoolcache/windows/Python + + - name: Fetch TTK-ParaView headless Windows installer + run: | + curl.exe -OL https://github.com/${{ env.PV_REPO }}/releases/download/${{ env.PV_TAG }}/ttk-paraview-headless.exe + + - name: Install ParaView + shell: cmd + run: | + ttk-paraview-headless.exe /S + + - name: Create & configure TTK build directory + shell: cmd + run: | + set CMAKE_PREFIX_PATH=%CONDA_ROOT%\Library\lib\cmake;%CONDA_ROOT%\Library\share\eigen3\cmake;%CONDA_ROOT%\Library\share\Qull\cmake;%CONDA_ROOT%\Library\cmake;%ProgramFiles%\TTK-ParaView\lib\cmake; + call "%ProgramFiles%\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat" + mkdir build + cd build + cmake ^ + -DCMAKE_COMPILE_WARNING_AS_ERROR=ON ^ + -DCMAKE_POLICY_DEFAULT_CMP0092=NEW ^ + -DCMAKE_POLICY_DEFAULT_CMP0074=NEW ^ + -DBUILD_SHARED_LIBS:BOOL=TRUE ^ + -DPython3_ROOT_DIR="%CONDA_ROOT%" ^ + -DGraphviz_INCLUDE_DIR="%CONDA_ROOT%\Library\include\graphviz" ^ + -DGraphviz_CDT_LIBRARY="%CONDA_ROOT%\Library\lib\cdt.lib" ^ + -DGraphviz_GVC_LIBRARY="%CONDA_ROOT%\Library\lib\gvc.lib" ^ + -DGraphviz_CGRAPH_LIBRARY="%CONDA_ROOT%\Library\lib\cgraph.lib" ^ + -DGraphviz_PATHPLAN_LIBRARY="%CONDA_ROOT%\Library\lib\pathplan.lib" ^ + -DZLIB_ROOT="%CONDA_ROOT%\Library" ^ + -DSQLite3_ROOT="%CONDA_ROOT%\Library" ^ + -DTTK_BUILD_PARAVIEW_PLUGINS=TRUE ^ + -DTTK_BUILD_VTK_WRAPPERS=TRUE ^ + -DTTK_BUILD_STANDALONE_APPS=TRUE ^ + -DTTK_ENABLE_KAMIKAZE=TRUE ^ + -DTTK_ENABLE_OPENMP=TRUE ^ + -DTTK_ENABLE_CPU_OPTIMIZATION=FALSE ^ + -DTTK_ENABLE_SHARED_BASE_LIBRARIES=TRUE ^ + -DTTK_IMPLICIT_PRECONDITIONS_THRESHOLD=64*64*64 ^ + .. + + - name: Fix clang-cl OpenMP flags in build.ninja + shell: bash + run: | + sed -i 's/-Xclang -fopenmp/-openmp/' build/build.ninja + + - name: Build & install TTK + shell: cmd + run: | + cd build + call "%ProgramFiles%\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat" + cmake --build . --config Release --parallel --target install + + - name: Test C++ example + shell: cmd + run: | + call "%ProgramFiles%\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat" + set CMAKE_PREFIX_PATH=%TTK_DIR%\lib\cmake;%PV_DIR%\lib\cmake + cd %GITHUB_WORKSPACE%\examples\c++ + mkdir build + cd build + cmake .. + cmake --build . --config Release --parallel + ttkExample-c++.exe -i ..\..\data\inputData.off + + - name: Test VTK-C++ example + shell: cmd + run: | + call "%ProgramFiles%\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat" + set CMAKE_PREFIX_PATH=%TTK_DIR%\lib\cmake;%PV_DIR%\lib\cmake + cd %GITHUB_WORKSPACE%\examples\vtk-c++ + mkdir build + cd build + cmake .. + cmake --build . --config Release --parallel + ttkExample-vtk-c++.exe -i ..\..\data\inputData.vtu + + - name: Test Python example [TEMPORARILY NOT ENFORCED] + continue-on-error: true + shell: cmd + run: | + set PYTHONPATH=%PV_DIR%\bin\Lib\site-packages;%TTK_DIR%\bin\Lib\site-packages;%CONDA_ROOT%\Lib + cd %GITHUB_WORKSPACE%\examples\python + python example.py ..\data\inputData.vtu + + - name: Test pvpython example + shell: cmd + run: | + set PYTHONPATH=%CONDA_ROOT%\Lib + set PV_PLUGIN_PATH=%TTK_DIR%\bin\plugins + cd %GITHUB_WORKSPACE%\examples\pvpython + pvpython.exe example.py ..\data\inputData.vtu + + - name: Test standalone + shell: cmd + run: | + cd %GITHUB_WORKSPACE%\examples\vtk-c++ + ttkHelloWorldCmd.exe -i %GITHUB_WORKSPACE%\examples\data\inputData.vtu + + - uses: actions/checkout@v4 + with: + repository: "topology-tool-kit/ttk-data" + ref: "dev" + path: "ttk-data" + name: Checkout ttk-data + + - name: Resample large datasets + shell: cmd + run: | + set PYTHONPATH=%CONDA_ROOT%\Lib + set PV_PLUGIN_PATH=%TTK_DIR%\bin\plugins + cd ttk-data + pvpython.exe python\resample.py ctBones.vti 128 128 128 ctBones.vti + + - name: Run ttk-data Python scripts + shell: cmd + run: | + set PYTHONPATH=%PV_DIR%\bin\Lib\site-packages;%TTK_DIR%\bin\Lib\site-packages;%CONDA_ROOT%\Lib;%CONDA_ROOT%\DLLs + set PV_PLUGIN_PATH=%TTK_DIR%\bin\plugins + cd ttk-data + rm python/nestedTrackingFromOverlap.py + # tmp removal of mpi example + rm python/mpiExample.py + # remove examples which fill up the memory + rm python/topologicalOptimization_darkSky.py + # remove examples using raster features + rm python/geometryApproximation.py + pvpython.exe -u python\run.py + + - name: Test ttk-data Python scripts results [NOT ENFORCED] + continue-on-error: true + shell: cmd + run: | + cd ttk-data + type python\res.json + FC python\hashes\windows.json python\res.json diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 302a71c25f..547464b02b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -16,592 +16,19 @@ on: # also triggered by pull requests on the "dev" branch branches: - 'dev' + # manual trigger + workflow_dispatch: concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true -env: - PV_TAG: v6.0.1-headless - PV_REPO: topology-tool-kit/ttk-paraview - - jobs: - - # ------------------# - # Test Ubuntu build # - # ------------------# - test-build-ubuntu: - runs-on: ${{ matrix.os }} - # trigger job when push event on a branch (not on a tag) only for - # the "topology-tool-kit/ttk" repository - # (pull-requests and tag pushes not affected) - if: ${{ github.repository_owner == 'topology-tool-kit' || !contains(github.ref, 'heads') }} - strategy: - matrix: - os: [ubuntu-22.04, ubuntu-24.04] - - steps: - - uses: actions/checkout@v4 - name: Checkout TTK source code - - - name: Install Ubuntu dependencies - run: | - sudo apt update - # TTK dependencies - sudo apt install -y \ - cargo \ - libboost-system-dev \ - libcgal-dev \ - libeigen3-dev \ - libgraphviz-dev \ - libosmesa-dev \ - libopenmpi-dev \ - libsqlite3-dev \ - libwebsocketpp-dev \ - graphviz \ - python3-sklearn \ - ninja-build \ - zlib1g-dev \ - libqhull-dev \ - dpkg-dev - cargo install sccache --version 0.4.2 --locked - echo "PATH=/root/.cargo/bin:$PATH" >> $GITHUB_ENV - - - name: Install and setup sccache - uses: f3d-app/sccache-setup-action@v1 - with: - key: ${{ matrix.os }}-0 - - - name: Install optional Spectra dependency - uses: ./.github/actions/install-spectra-unix - - - name: Install optional ZFP dependency - uses: ./.github/actions/install-zfp-unix - - # TODO: try to replicate for mac - - name: Install Torch - shell: bash - run: | - wget https://download.pytorch.org/libtorch/cpu/libtorch-cxx11-abi-shared-with-deps-2.3.1%2Bcpu.zip - unzip libtorch-cxx11-abi-shared-with-deps-2.3.1+cpu.zip - sudo cp -R libtorch/* /usr/local/ - - - name: Fetch TTK-ParaView headless Debian package - run: | - wget -O ttk-paraview-headless.deb \ - https://github.com/${{ env.PV_REPO }}/releases/download/${{ env.PV_TAG }}/ttk-paraview-headless-${{ matrix.os }}.deb - - - name: Install ParaView .deb - run: | - sudo apt install ./ttk-paraview-headless.deb - - - name: Create & configure TTK build directory - run: | - mkdir build - cd build - cmake \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_C_COMPILER_LAUNCHER=sccache \ - -DCMAKE_CXX_COMPILER_LAUNCHER=sccache \ - -DCMAKE_INSTALL_PREFIX=/usr \ - -DTTK_BUILD_PARAVIEW_PLUGINS=TRUE \ - -DTTK_BUILD_VTK_WRAPPERS=TRUE \ - -DTTK_BUILD_STANDALONE_APPS=TRUE \ - -DTTK_ENABLE_KAMIKAZE=TRUE \ - -DTTK_ENABLE_MPI=TRUE \ - -DTTK_ENABLE_CPU_OPTIMIZATION=FALSE \ - -DTTK_ENABLE_SHARED_BASE_LIBRARIES=TRUE \ - -DTTK_IMPLICIT_PRECONDITIONS_THRESHOLD=64*64*64 \ - -GNinja \ - $GITHUB_WORKSPACE - env: - CXXFLAGS: -Werror - - - uses: ammaraskar/gcc-problem-matcher@master - - name: Build, install TTK & package it - run: | - cd build - cmake --build . --parallel - cpack -G DEB - sudo cmake --build . --target install - - - name: Show sccache results - shell: bash - run: sccache --show-stats - - - name: Run TTK tests - uses: ./.github/actions/test-ttk-ubuntu - - - name: Upload TTK .deb package for fast install in tests - uses: actions/upload-artifact@v4 - with: - name: ttk-for-tests-${{ matrix.os }}.deb - path: build/ttk.deb - - # ------------------# - # Tests on ttk-data # - # ------------------# - run-python-screenshots-tests: - runs-on: ${{ matrix.os }} - needs: test-build-ubuntu - strategy: - matrix: - os: [ubuntu-22.04, ubuntu-24.04] - testSet: [pyTests, screenshotTests] - steps: - - name: Install Ubuntu dependencies - run: | - sudo apt update - - - name: Install Torch - shell: bash - run: | - wget https://download.pytorch.org/libtorch/cpu/libtorch-cxx11-abi-shared-with-deps-2.3.1%2Bcpu.zip - unzip libtorch-cxx11-abi-shared-with-deps-2.3.1+cpu.zip - sudo cp -R libtorch/* /usr/local/ - - - name: Fetch TTK-ParaView headless Debian package - run: | - wget -O ttk-paraview-headless.deb \ - https://github.com/${{ env.PV_REPO }}/releases/download/${{ env.PV_TAG }}/ttk-paraview-headless-${{ matrix.os }}.deb - - - name: Install ParaView .deb - run: | - sudo apt install ./ttk-paraview-headless.deb - - - name: Fetch TTK packages we just built in the test-build-ubuntu job - uses: actions/download-artifact@v4.1.7 - with: - name: ttk-for-tests-${{ matrix.os }}.deb - - - name: Installing the previously built ttk package - run: | - sudo apt install ./ttk.deb - - - uses: actions/checkout@v4 - with: - repository: "topology-tool-kit/ttk-data" - ref: "dev" - path: "ttk-data" - name: Checkout ttk-data - - - name: Resample large datasets - shell: python3 {0} - working-directory: ./ttk-data - run: | - from paraview import simple - for ds in ["ctBones.vti"]: - vti = simple.XMLImageDataReader(FileName=ds) - rsi = simple.ResampleToImage(Input=vti) - rsi.SamplingDimensions = [128, 128, 128] - simple.SaveData(ds, rsi) - - - name: Run ttk-data states [NOT ENFORCED] - if: matrix.testSet == 'screenshotTests' - id: validate - continue-on-error: true - run: | - VERS=$(hostnamectl | grep "Operating System") - # Ubuntu 22.04 OOM killer also kills the parent process... - if [[ "$VERS" == *"22.04"* ]] || [[ "$VERS" == *"24.04"* ]]; then - rm ttk-data/states/mergeTreeClustering.pvsm - rm ttk-data/states/mergeTreePGA.pvsm - rm ttk-data/states/mergeTreeTemporalReduction.pvsm - rm ttk-data/states/persistentGenerators_darkSky.pvsm - fi - # remove buggy example - # related issue: https://github.com/topology-tool-kit/ttk/issues/1055 - rm ttk-data/states/nestedTrackingFromOverlap.py - # remove examples which fill up the memory - rm ttk-data/states/topologicalOptimization_darkSky.pvsm - - cd ttk-data/tests - mkdir output_screenshots - if ! python3 -u validate.py; then - - if [[ "$VERS" == *"22.04"* ]] || [[ "$VERS" == *"24.04"* ]]; then - # weird opacity difference between the two Ubuntus - rm -f output_screenshots/clusteringKelvinHelmholtzInstabilities_1.png - rm -f output_screenshots/clusteringKelvinHelmholtzInstabilities_2.png - fi - if [ "$(ls -A output_screenshots)" ]; then - tar zcf screenshots.tar.gz output_screenshots - false - fi - fi - - - name: Upload result screenshots - if: steps.validate.outcome == 'failure' && matrix.testSet == 'screenshotTests' - uses: actions/upload-artifact@v4 - with: - name: screenshots-${{ matrix.os }}.tar.gz - path: ttk-data/tests/screenshots.tar.gz - retention-days: 10 - - - name: Run ttk-data Python scripts - if: matrix.testSet == 'pyTests' - run: | - cd ttk-data - # remove buggy example - # related issue: https://github.com/topology-tool-kit/ttk/issues/1055 - rm python/nestedTrackingFromOverlap.py - # tmp removal of mpi example - rm python/mpiExample.py - # remove examples which fill up the memory - rm python/topologicalOptimization_darkSky.py - pvpython -u python/run.py - - - name: Test ttk-data Python scripts results [NOT ENFORCED] - if: matrix.testSet == 'pyTests' - continue-on-error: true - run: | - cd ttk-data - cat python/res.json - diff python/hashes/${{ matrix.os }}.json python/res.json - - - name: Delete TTK package artifact - uses: geekyeggo/delete-artifact@v5 - # delete package only once - if: matrix.testSet == 'screenshotTests' - with: - name: ttk-for-tests-${{ matrix.os }}.deb - - - # -----------------# - # Test macOS build # - # -----------------# - test-build-macos: - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [macos-14, macos-15] - if: ${{ github.repository_owner == 'topology-tool-kit' || !contains(github.ref, 'heads') }} - env: - DYLD_LIBRARY_PATH: /usr/local/lib - - steps: - - uses: actions/checkout@v4 - name: Checkout TTK source code - - - uses: actions/setup-python@v5 - with: - python-version: '3.13' - - - name: Install macOS dependencies - run: | - # ParaView dependencies - brew install --cask xquartz - brew install ninja open-mpi libomp - # TTK dependencies - brew install boost cgal eigen graphviz spectra sqlite numpy qhull - - - name: Install and setup sccache - uses: f3d-app/sccache-setup-action@v1 - with: - key: macos-0 - - - name: Install optional Spectra dependency - uses: ./.github/actions/install-spectra-unix - - - name: Install optional ZFP dependency - uses: ./.github/actions/install-zfp-unix - - - name: Fetch TTK-ParaView headless macOS binary archive - run: | - wget -O ttk-paraview-headless.tar.gz \ - https://github.com/${{ env.PV_REPO }}/releases/download/${{ env.PV_TAG }}/ttk-paraview-headless-${{ matrix.os }}.tar.gz - - - name: Install ParaView - run: | - tar xzf ttk-paraview-headless.tar.gz - sudo cp -r ttk-paraview/* /usr/local - # pvpython does not embed the correct PYTHONPATH - echo "PYTHONPATH=/usr/local/lib/python3.13/site-packages:$PYTHONPATH" >> $GITHUB_ENV - pvpython -m pip install --break-system-packages scikit-learn - # pvpython is expecting a vtkpython executable at this path - sudo ln -s /usr/local/bin/pvpython /Library/Frameworks/Python.framework/Versions/3.13/vtkpython - - - name: Create & configure TTK build directory - run: | - mkdir build - cd build - cmake \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_C_COMPILER_LAUNCHER=sccache \ - -DCMAKE_CXX_COMPILER_LAUNCHER=sccache \ - -DOpenMP_C_FLAGS="-Xpreprocessor -fopenmp -I/opt/homebrew/opt/libomp/include" \ - -DOpenMP_C_LIB_NAMES="omp" \ - -DOpenMP_CXX_FLAGS="-Xpreprocessor -fopenmp -I/opt/homebrew/opt/libomp/include" \ - -DOpenMP_CXX_LIB_NAMES="omp" \ - -DOpenMP_omp_LIBRARY=/opt/homebrew/opt/libomp/lib/libomp.dylib \ - -DCMAKE_EXE_LINKER_FLAGS="-L/opt/homebrew/opt/libomp/lib -lomp" \ - -DTTK_BUILD_PARAVIEW_PLUGINS=TRUE \ - -DTTK_BUILD_VTK_WRAPPERS=TRUE \ - -DTTK_BUILD_STANDALONE_APPS=TRUE \ - -DTTK_ENABLE_KAMIKAZE=TRUE \ - -DTTK_ENABLE_MPI=FALSE \ - -DTTK_ENABLE_CPU_OPTIMIZATION=FALSE \ - -DTTK_ENABLE_SHARED_BASE_LIBRARIES=TRUE \ - -DTTK_IMPLICIT_PRECONDITIONS_THRESHOLD=64*64*64 \ - -GNinja \ - $GITHUB_WORKSPACE - env: - CXXFLAGS: -Werror - - - uses: ammaraskar/gcc-problem-matcher@master - - name: Build & install TTK - run: | - cd build - cmake --build . --parallel - sudo cmake --build . --target install - - - name: Show sccache results - shell: bash - run: sccache --show-stats - - - name: Run TTK tests - uses: ./.github/actions/test-ttk-macos - - - uses: actions/checkout@v4 - with: - repository: "topology-tool-kit/ttk-data" - ref: "dev" - path: "ttk-data" - name: Checkout ttk-data - - - name: Run ttk-data states [NOT ENFORCED] - id: validate - continue-on-error: true - run: | - # remove buggy example - # related issue: https://github.com/topology-tool-kit/ttk/issues/1055 - rm ttk-data/states/nestedTrackingFromOverlap.py - # remove examples which fill up the memory - rm ttk-data/states/topologicalOptimization_darkSky.pvsm - # remove examples that take too long to render under mac - rm ttk-data/states/persistentGenerators_householdAnalysis.pvsm - cd ttk-data/tests - mkdir output_screenshots - pvpython -u validate.py || (tar zcf screenshots.tar.gz output_screenshots && false) - env: - PV_PLUGIN_PATH: /usr/local/bin/plugins/TopologyToolKit - - - name: Upload result screenshots - if: steps.validate.outcome == 'failure' - uses: actions/upload-artifact@v4 - with: - name: screenshots-${{ matrix.os }}.tar.gz - path: ttk-data/tests/screenshots.tar.gz - retention-days: 10 - - - name: Run ttk-data Python scripts - run: | - cd ttk-data - # remove buggy example - # related issue: https://github.com/topology-tool-kit/ttk/issues/1055 - rm python/nestedTrackingFromOverlap.py - # tmp removal of mpi example - rm python/mpiExample.py - rm python/distributedPersistenceDiagram.py - # remove examples which fill up the memory - rm python/topologicalOptimization_darkSky.py - # remove sklearn examples -- buggy on MacOS since sklearn-1.7 - rm python/1manifoldLearning.py python/clusteringKelvinHelmholtzInstabilities.py python/karhunenLoveDigits64Dimensions.py python/mergeTreeClustering.py python/persistentGenerators_householdAnalysis.py python/persistentGenerators_periodicPicture.py - pvpython -u python/run.py - env: - PV_PLUGIN_PATH: /usr/local/bin/plugins/TopologyToolKit - - - name: Test ttk-data Python scripts results [NOT ENFORCED] - continue-on-error: true - run: | - cd ttk-data - cat python/res.json - diff python/hashes/macOS.json python/res.json - - # ------------------ # - # Test Windows build # - # ------------------ # - test-build-windows: - runs-on: windows-2022 - if: ${{ github.repository_owner == 'topology-tool-kit' || !contains(github.ref, 'heads') }} - env: - PV_DIR: C:\Program Files\TTK-ParaView - TTK_DIR: C:\Program Files (x86)\ttk - CONDA_ROOT: C:\Miniconda - steps: - - uses: actions/checkout@v4 - name: Checkout TTK source code - - - uses: s-weigand/setup-conda@v1 - - - name: Install dependencies with conda - shell: bash - run: | - conda install -c conda-forge libboost-devel glew eigen spectralib zfp \ - sqlite scikit-learn graphviz ninja python=3.10 zlib qhull \ - llvm-openmp clangxx=18 - # add TTK & ParaView install folders to PATH - echo "$PV_DIR/bin" >> $GITHUB_PATH - echo "$TTK_DIR/bin" >> $GITHUB_PATH - conda info --all - - - name: Install and setup sccache - uses: f3d-app/sccache-setup-action@v1 - with: - key: windows-0 - - - name: Remove hosted Python - shell: bash - run: | - rm -rf C:/hostedtoolcache/windows/Python - - - name: Fetch TTK-ParaView headless Windows installer - run: | - curl.exe -OL https://github.com/${{ env.PV_REPO }}/releases/download/${{ env.PV_TAG }}/ttk-paraview-headless.exe - - - name: Install ParaView - shell: cmd - run: | - ttk-paraview-headless.exe /S - - - name: Create & configure TTK build directory - shell: cmd - run: | - set CMAKE_PREFIX_PATH=%CONDA_ROOT%\Library\lib\cmake;%CONDA_ROOT%\Library\share\eigen3\cmake;%CONDA_ROOT%\Library\share\Qull\cmake;%CONDA_ROOT%\Library\cmake;%ProgramFiles%\TTK-ParaView\lib\cmake; - set CC=clang-cl.exe - set CXX=clang-cl.exe - call "%ProgramFiles%\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat" - mkdir build - cd build - cmake ^ - -DCMAKE_BUILD_TYPE=Release ^ - -DCMAKE_POLICY_DEFAULT_CMP0092=NEW ^ - -DCMAKE_POLICY_DEFAULT_CMP0074=NEW ^ - -DBUILD_SHARED_LIBS:BOOL=TRUE ^ - -DCMAKE_C_COMPILER_LAUNCHER=sccache ^ - -DCMAKE_CXX_COMPILER_LAUNCHER=sccache ^ - -DPython3_ROOT_DIR="%CONDA_ROOT%" ^ - -DGraphviz_INCLUDE_DIR="%CONDA_ROOT%\Library\include\graphviz" ^ - -DGraphviz_CDT_LIBRARY="%CONDA_ROOT%\Library\lib\cdt.lib" ^ - -DGraphviz_GVC_LIBRARY="%CONDA_ROOT%\Library\lib\gvc.lib" ^ - -DGraphviz_CGRAPH_LIBRARY="%CONDA_ROOT%\Library\lib\cgraph.lib" ^ - -DGraphviz_PATHPLAN_LIBRARY="%CONDA_ROOT%\Library\lib\pathplan.lib" ^ - -DZLIB_ROOT="%CONDA_ROOT%\Library" ^ - -DSQLite3_ROOT="%CONDA_ROOT%\Library" ^ - -DTTK_BUILD_PARAVIEW_PLUGINS=TRUE ^ - -DTTK_BUILD_VTK_WRAPPERS=TRUE ^ - -DTTK_BUILD_STANDALONE_APPS=TRUE ^ - -DTTK_ENABLE_KAMIKAZE=TRUE ^ - -DTTK_ENABLE_OPENMP=TRUE ^ - -DTTK_ENABLE_CPU_OPTIMIZATION=FALSE ^ - -DTTK_ENABLE_SHARED_BASE_LIBRARIES=TRUE ^ - -DTTK_IMPLICIT_PRECONDITIONS_THRESHOLD=64*64*64 ^ - -GNinja ^ - .. - env: - CXXFLAGS: -Werror - - - name: Fix clang-cl OpenMP flags in build.ninja - shell: bash - run: | - sed -i 's/-Xclang -fopenmp/-openmp/' build/build.ninja - - - name: Build & install TTK - shell: cmd - run: | - cd build - call "%ProgramFiles%\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat" - cmake --build . --config Release --parallel --target install - - - name: Show sccache results - shell: bash - run: sccache --show-stats - - - name: Test C++ example - shell: cmd - run: | - set CC=clang-cl.exe - set CXX=clang-cl.exe - call "%ProgramFiles%\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat" - set CMAKE_PREFIX_PATH=%TTK_DIR%\lib\cmake;%PV_DIR%\lib\cmake - cd %GITHUB_WORKSPACE%\examples\c++ - mkdir build - cd build - cmake -DCMAKE_BUILD_TYPE=Release -GNinja .. - cmake --build . --config Release --parallel - ttkExample-c++.exe -i ..\..\data\inputData.off - - - name: Test VTK-C++ example - shell: cmd - run: | - set CC=clang-cl.exe - set CXX=clang-cl.exe - call "%ProgramFiles%\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat" - set CMAKE_PREFIX_PATH=%TTK_DIR%\lib\cmake;%PV_DIR%\lib\cmake - cd %GITHUB_WORKSPACE%\examples\vtk-c++ - mkdir build - cd build - cmake -DCMAKE_BUILD_TYPE=Release -GNinja .. - cmake --build . --config Release --parallel - ttkExample-vtk-c++.exe -i ..\..\data\inputData.vtu - - - name: Test Python example [TEMPORARILY NOT ENFORCED] - continue-on-error: true - shell: cmd - run: | - set PYTHONPATH=%PV_DIR%\bin\Lib\site-packages;%TTK_DIR%\bin\Lib\site-packages;%CONDA_ROOT%\Lib - cd %GITHUB_WORKSPACE%\examples\python - python example.py ..\data\inputData.vtu - - - name: Test pvpython example - shell: cmd - run: | - set PYTHONPATH=%CONDA_ROOT%\Lib - set PV_PLUGIN_PATH=%TTK_DIR%\bin\plugins - cd %GITHUB_WORKSPACE%\examples\pvpython - pvpython.exe example.py ..\data\inputData.vtu - - - name: Test standalone - shell: cmd - run: | - cd %GITHUB_WORKSPACE%\examples\vtk-c++ - ttkHelloWorldCmd.exe -i %GITHUB_WORKSPACE%\examples\data\inputData.vtu - - - uses: actions/checkout@v4 - with: - repository: "topology-tool-kit/ttk-data" - ref: "dev" - path: "ttk-data" - name: Checkout ttk-data - - - name: Resample large datasets - shell: cmd - run: | - set PYTHONPATH=%CONDA_ROOT%\Lib - set PV_PLUGIN_PATH=%TTK_DIR%\bin\plugins - cd ttk-data - pvpython.exe python\resample.py ctBones.vti 128 128 128 ctBones.vti - - - name: Run ttk-data Python scripts - shell: cmd - run: | - set PYTHONPATH=%PV_DIR%\bin\Lib\site-packages;%TTK_DIR%\bin\Lib\site-packages;%CONDA_ROOT%\Lib;%CONDA_ROOT%\DLLs - set PV_PLUGIN_PATH=%TTK_DIR%\bin\plugins - cd ttk-data - rm python/nestedTrackingFromOverlap.py - # tmp removal of mpi example - rm python/mpiExample.py - # remove examples which fill up the memory - rm python/topologicalOptimization_darkSky.py - # remove examples using raster features - rm python/geometryApproximation.py - pvpython.exe -u python\run.py - - - name: Test ttk-data Python scripts results [NOT ENFORCED] - continue-on-error: true - shell: cmd - run: | - cd ttk-data - type python\res.json - FC python\hashes\windows.json python\res.json + call-test-ubuntu: + uses: ./.github/workflows/test-ubuntu.yml + call-test-macos: + uses: ./.github/workflows/test-macos.yml + call-test-windows: + uses: ./.github/workflows/test-windows.yml + call-check-code: + uses: ./.github/workflows/check.yml diff --git a/CMake/config.cmake b/CMake/config.cmake index feb291f36a..39da16c7ea 100644 --- a/CMake/config.cmake +++ b/CMake/config.cmake @@ -146,7 +146,7 @@ list(INSERT CMAKE_MODULE_PATH 0 # mandatory packages -find_package(Boost REQUIRED) +find_package(Boost REQUIRED CONFIG) if(Boost_FOUND) message(STATUS "Found Boost ${Boost_VERSION} (${Boost_INCLUDE_DIR})") endif() diff --git a/CMakeLists.txt b/CMakeLists.txt index e02836b78f..1ba24d8dfa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,10 @@ cmake_minimum_required(VERSION 3.21) # since paraview 5.10 + +set(CMAKE_POLICY_DEFAULT_CMP0074 NEW) +set(CMAKE_POLICY_DEFAULT_CMP0092 NEW) +set(CMAKE_POLICY_DEFAULT_CMP0167 NEW) +set(CMAKE_POLICY_DEFAULT_CMP0174 NEW) + # The C is required to build with VTK when it has MPI project(ttk VERSION 1.3.0 LANGUAGES CXX C)