Skip to content

Commit

Permalink
Merge pull request #837 from pierre-guillou/ccache_windows
Browse files Browse the repository at this point in the history
GitHub Actions: Fasten Windows builds with sccache
  • Loading branch information
julien-tierny committed Oct 11, 2022
2 parents 33280d7 + ac9f668 commit 258d561
Show file tree
Hide file tree
Showing 4 changed files with 171 additions and 16 deletions.
119 changes: 118 additions & 1 deletion .github/workflows/ccache.yml
Original file line number Diff line number Diff line change
Expand Up @@ -171,14 +171,123 @@ jobs:
name: ttk-ccache-macOS
path: /Users/runner/work/ttk/ttk-ccache.tar.gz

# ------- #
# Windows #
# ------- #
ccache-windows:
runs-on: windows-latest
env:
CONDA_ROOT: C:\Miniconda
steps:
- uses: actions/checkout@v2
name: Checkout TTK source code

- uses: s-weigand/setup-conda@v1

- name: Install dependencies with conda
shell: bash
run: |
conda install -c conda-forge boost glew eigen spectralib zfp \
scikit-learn packaging openmp graphviz ninja sccache
# add sccache to PATH
echo "$CONDA_ROOT/bin" >> $GITHUB_PATH
- name: Remove hosted Python
shell: bash
run: |
rm -rf C:/hostedtoolcache/windows/Python
- name: Fetch TTK-ParaView headless Windows installer
run: |
Invoke-WebRequest `
-OutFile ttk-paraview-headless.exe `
-Uri 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\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"
sccache --stop-server
sccache --start-server
mkdir build
cd build
cmake ^
-DCMAKE_BUILD_TYPE=Release ^
-DCMAKE_POLICY_DEFAULT_CMP0092=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" ^
-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 ^
..
- 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: Archive cache
shell: bash
run: |
cd /c/Users/runneradmin/AppData/Local/Mozilla/sccache
tar czf ttk-sccache.tar.gz cache
- name: Upload sccache archive
uses: actions/upload-artifact@v2
with:
name: ttk-sccache-windows
path: C:\Users\runneradmin\AppData\Local\Mozilla\sccache\ttk-sccache.tar.gz


# --------------------- #
# Upload release assets #
# --------------------- #
create-release:
runs-on: ubuntu-latest
needs: [ccache-ubuntu, ccache-macos]
needs: [ccache-ubuntu, ccache-macos, ccache-windows]
steps:

- name: Delete previous release
uses: actions/github-script@v6
continue-on-error: true
with:
script: |
const { owner, repo } = context.repo
const { data: { id } } = await github.rest.repos.getReleaseByTag({
owner,
repo,
tag: "ccache"
})
await github.rest.repos.deleteRelease({ owner, repo, release_id: id })
- name: Create Release
id: create_release
uses: actions/create-release@v1
Expand Down Expand Up @@ -224,3 +333,11 @@ jobs:
tag: ${{ github.ref }}
file: ttk-ccache-macOS/ttk-ccache.tar.gz
asset_name: ttk-ccache-macOS.tar.gz

- name: Upload sccache Windows archive
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref }}
file: ttk-sccache-windows/ttk-sccache.tar.gz
asset_name: ttk-sccache-windows.tar.gz
4 changes: 2 additions & 2 deletions .github/workflows/package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ jobs:
shell: bash
run: |
conda install -c conda-forge "qt>=5.12" boost eigen spectralib zfp \
scikit-learn packaging openmp "graphviz>=2.50"
scikit-learn packaging openmp graphviz
- name: Remove hosted Python
shell: bash
Expand Down Expand Up @@ -410,7 +410,7 @@ jobs:
shell: bash
run: |
conda install -c conda-forge "qt>=5.12" boost eigen spectralib zfp \
scikit-learn packaging openmp "graphviz>=2.50"
scikit-learn packaging openmp graphviz
- name: Remove hosted Python
shell: bash
Expand Down
61 changes: 50 additions & 11 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -328,13 +328,36 @@ jobs:
shell: bash
run: |
conda install -c conda-forge boost glew eigen spectralib zfp \
scikit-learn packaging openmp "graphviz>=2.50"
scikit-learn packaging openmp graphviz ninja sccache
# add sccache to PATH
echo "$CONDA_ROOT/bin" >> $GITHUB_PATH
# add TTK & ParaView install folders to PATH
echo "$PV_DIR/bin" >> $GITHUB_PATH
echo "$TTK_DIR/bin" >> $GITHUB_PATH
- name: Remove hosted Python
shell: bash
run: |
rm -rf C:/hostedtoolcache/windows/Python
- uses: dsaltares/fetch-gh-release-asset@master
continue-on-error: true
name: Fetch archived ccache
with:
repo: "topology-tool-kit/ttk"
version: "tags/ccache"
file: "ttk-sccache-windows.tar.gz"
target: "ttk-sccache.tar.gz"
token: ${{ secrets.GITHUB_TOKEN }}

- name: Decompress ccache archive
continue-on-error: true
shell: bash
run: |
tar xzf ttk-sccache.tar.gz
mkdir -p /c/Users/runneradmin/AppData/Local/Mozilla/sccache
mv cache /c/Users/runneradmin/AppData/Local/Mozilla/sccache
- name: Fetch TTK-ParaView headless Windows installer
run: |
Invoke-WebRequest `
Expand All @@ -350,11 +373,19 @@ jobs:
shell: cmd
run: |
set CMAKE_PREFIX_PATH=%CONDA_ROOT%\Library\lib\cmake;%CONDA_ROOT%\Library\share\eigen3\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"
sccache --stop-server
sccache --start-server
mkdir build
cd build
cmake ^
-DCMAKE_BUILD_TYPE=Release ^
-DCMAKE_POLICY_DEFAULT_CMP0092=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" ^
Expand All @@ -369,40 +400,48 @@ jobs:
-DTTK_ENABLE_CPU_OPTIMIZATION=FALSE ^
-DTTK_ENABLE_SHARED_BASE_LIBRARIES=TRUE ^
-DTTK_IMPLICIT_PRECONDITIONS_THRESHOLD=64*64*64 ^
-G"Visual Studio 17 2022" ^
-Tclangcl ^
-GNinja ^
..
- name: Build & install TTK
- 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
# set PATH environment variable
echo "$PV_DIR/bin" >> $GITHUB_PATH
echo "$TTK_DIR/bin" >> $GITHUB_PATH
- 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 -G"Visual Studio 17 2022" -Tclangcl ..
cmake -DCMAKE_BUILD_TYPE=Release -GNinja ..
cmake --build . --config Release --parallel
Release\ttkExample-c++.exe -i ..\..\data\inputData.off
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 -G"Visual Studio 17 2022" -Tclangcl ..
cmake -DCMAKE_BUILD_TYPE=Release -GNinja ..
cmake --build . --config Release --parallel
Release\ttkExample-vtk-c++.exe -i ..\..\data\inputData.vtu
ttkExample-vtk-c++.exe -i ..\..\data\inputData.vtu
- name: Test Python example
shell: cmd
Expand Down
3 changes: 1 addition & 2 deletions core/base/lDistanceMatrix/LDistanceMatrix.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ int ttk::LDistanceMatrix::execute(std::vector<std::vector<double>> &output,

// compute matrix upper triangle
#ifdef TTK_ENABLE_OPENMP
#pragma omp parallel for num_threads(this->threadNumber_) schedule(dynamic) \
firstprivate(worker)
#pragma omp parallel for num_threads(this->threadNumber_) firstprivate(worker)
#endif // TTK_ENABLE_OPENMP
for(size_t i = 0; i < nInputs; ++i) {
for(size_t j = i + 1; j < nInputs; ++j) {
Expand Down

0 comments on commit 258d561

Please sign in to comment.