Skip to content

Commit 258d561

Browse files
Merge pull request #837 from pierre-guillou/ccache_windows
GitHub Actions: Fasten Windows builds with sccache
2 parents 33280d7 + ac9f668 commit 258d561

File tree

4 files changed

+171
-16
lines changed

4 files changed

+171
-16
lines changed

.github/workflows/ccache.yml

Lines changed: 118 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,14 +171,123 @@ jobs:
171171
name: ttk-ccache-macOS
172172
path: /Users/runner/work/ttk/ttk-ccache.tar.gz
173173

174+
# ------- #
175+
# Windows #
176+
# ------- #
177+
ccache-windows:
178+
runs-on: windows-latest
179+
env:
180+
CONDA_ROOT: C:\Miniconda
181+
steps:
182+
- uses: actions/checkout@v2
183+
name: Checkout TTK source code
184+
185+
- uses: s-weigand/setup-conda@v1
186+
187+
- name: Install dependencies with conda
188+
shell: bash
189+
run: |
190+
conda install -c conda-forge boost glew eigen spectralib zfp \
191+
scikit-learn packaging openmp graphviz ninja sccache
192+
# add sccache to PATH
193+
echo "$CONDA_ROOT/bin" >> $GITHUB_PATH
194+
195+
- name: Remove hosted Python
196+
shell: bash
197+
run: |
198+
rm -rf C:/hostedtoolcache/windows/Python
199+
200+
- name: Fetch TTK-ParaView headless Windows installer
201+
run: |
202+
Invoke-WebRequest `
203+
-OutFile ttk-paraview-headless.exe `
204+
-Uri https://github.com/${{ env.PV_REPO }}/releases/download/${{ env.PV_TAG }}/ttk-paraview-headless.exe
205+
206+
- name: Install ParaView
207+
shell: cmd
208+
run: |
209+
ttk-paraview-headless.exe /S
210+
211+
- name: Create & configure TTK build directory
212+
shell: cmd
213+
run: |
214+
set CMAKE_PREFIX_PATH=%CONDA_ROOT%\Library\lib\cmake;%CONDA_ROOT%\Library\share\eigen3\cmake;%CONDA_ROOT%\Library\cmake;%ProgramFiles%\TTK-ParaView\lib\cmake
215+
set CC=clang-cl.exe
216+
set CXX=clang-cl.exe
217+
call "%ProgramFiles%\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
218+
sccache --stop-server
219+
sccache --start-server
220+
mkdir build
221+
cd build
222+
cmake ^
223+
-DCMAKE_BUILD_TYPE=Release ^
224+
-DCMAKE_POLICY_DEFAULT_CMP0092=NEW ^
225+
-DBUILD_SHARED_LIBS:BOOL=TRUE ^
226+
-DCMAKE_C_COMPILER_LAUNCHER=sccache ^
227+
-DCMAKE_CXX_COMPILER_LAUNCHER=sccache ^
228+
-DPython3_ROOT_DIR="%CONDA_ROOT%" ^
229+
-DGraphviz_INCLUDE_DIR="%CONDA_ROOT%\Library\include\graphviz" ^
230+
-DGraphviz_CDT_LIBRARY="%CONDA_ROOT%\Library\lib\cdt.lib" ^
231+
-DGraphviz_GVC_LIBRARY="%CONDA_ROOT%\Library\lib\gvc.lib" ^
232+
-DGraphviz_CGRAPH_LIBRARY="%CONDA_ROOT%\Library\lib\cgraph.lib" ^
233+
-DGraphviz_PATHPLAN_LIBRARY="%CONDA_ROOT%\Library\lib\pathplan.lib" ^
234+
-DTTK_BUILD_PARAVIEW_PLUGINS=TRUE ^
235+
-DTTK_BUILD_VTK_WRAPPERS=TRUE ^
236+
-DTTK_BUILD_STANDALONE_APPS=TRUE ^
237+
-DTTK_ENABLE_KAMIKAZE=TRUE ^
238+
-DTTK_ENABLE_OPENMP=TRUE ^
239+
-DTTK_ENABLE_CPU_OPTIMIZATION=FALSE ^
240+
-DTTK_ENABLE_SHARED_BASE_LIBRARIES=TRUE ^
241+
-DTTK_IMPLICIT_PRECONDITIONS_THRESHOLD=64*64*64 ^
242+
-GNinja ^
243+
..
244+
245+
- name: Fix clang-cl OpenMP flags in build.ninja
246+
shell: bash
247+
run: |
248+
sed -i 's/-Xclang -fopenmp/-openmp/' build/build.ninja
249+
250+
- name: Build & install TTK
251+
shell: cmd
252+
run: |
253+
cd build
254+
call "%ProgramFiles%\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
255+
cmake --build . --config Release --parallel --target install
256+
257+
- name: Archive cache
258+
shell: bash
259+
run: |
260+
cd /c/Users/runneradmin/AppData/Local/Mozilla/sccache
261+
tar czf ttk-sccache.tar.gz cache
262+
263+
- name: Upload sccache archive
264+
uses: actions/upload-artifact@v2
265+
with:
266+
name: ttk-sccache-windows
267+
path: C:\Users\runneradmin\AppData\Local\Mozilla\sccache\ttk-sccache.tar.gz
268+
269+
174270
# --------------------- #
175271
# Upload release assets #
176272
# --------------------- #
177273
create-release:
178274
runs-on: ubuntu-latest
179-
needs: [ccache-ubuntu, ccache-macos]
275+
needs: [ccache-ubuntu, ccache-macos, ccache-windows]
180276
steps:
181277

278+
- name: Delete previous release
279+
uses: actions/github-script@v6
280+
continue-on-error: true
281+
with:
282+
script: |
283+
const { owner, repo } = context.repo
284+
const { data: { id } } = await github.rest.repos.getReleaseByTag({
285+
owner,
286+
repo,
287+
tag: "ccache"
288+
})
289+
await github.rest.repos.deleteRelease({ owner, repo, release_id: id })
290+
182291
- name: Create Release
183292
id: create_release
184293
uses: actions/create-release@v1
@@ -224,3 +333,11 @@ jobs:
224333
tag: ${{ github.ref }}
225334
file: ttk-ccache-macOS/ttk-ccache.tar.gz
226335
asset_name: ttk-ccache-macOS.tar.gz
336+
337+
- name: Upload sccache Windows archive
338+
uses: svenstaro/upload-release-action@v2
339+
with:
340+
repo_token: ${{ secrets.GITHUB_TOKEN }}
341+
tag: ${{ github.ref }}
342+
file: ttk-sccache-windows/ttk-sccache.tar.gz
343+
asset_name: ttk-sccache-windows.tar.gz

.github/workflows/package.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ jobs:
320320
shell: bash
321321
run: |
322322
conda install -c conda-forge "qt>=5.12" boost eigen spectralib zfp \
323-
scikit-learn packaging openmp "graphviz>=2.50"
323+
scikit-learn packaging openmp graphviz
324324
325325
- name: Remove hosted Python
326326
shell: bash
@@ -410,7 +410,7 @@ jobs:
410410
shell: bash
411411
run: |
412412
conda install -c conda-forge "qt>=5.12" boost eigen spectralib zfp \
413-
scikit-learn packaging openmp "graphviz>=2.50"
413+
scikit-learn packaging openmp graphviz
414414
415415
- name: Remove hosted Python
416416
shell: bash

.github/workflows/test.yml

Lines changed: 50 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -328,13 +328,36 @@ jobs:
328328
shell: bash
329329
run: |
330330
conda install -c conda-forge boost glew eigen spectralib zfp \
331-
scikit-learn packaging openmp "graphviz>=2.50"
331+
scikit-learn packaging openmp graphviz ninja sccache
332+
# add sccache to PATH
333+
echo "$CONDA_ROOT/bin" >> $GITHUB_PATH
334+
# add TTK & ParaView install folders to PATH
335+
echo "$PV_DIR/bin" >> $GITHUB_PATH
336+
echo "$TTK_DIR/bin" >> $GITHUB_PATH
332337
333338
- name: Remove hosted Python
334339
shell: bash
335340
run: |
336341
rm -rf C:/hostedtoolcache/windows/Python
337342
343+
- uses: dsaltares/fetch-gh-release-asset@master
344+
continue-on-error: true
345+
name: Fetch archived ccache
346+
with:
347+
repo: "topology-tool-kit/ttk"
348+
version: "tags/ccache"
349+
file: "ttk-sccache-windows.tar.gz"
350+
target: "ttk-sccache.tar.gz"
351+
token: ${{ secrets.GITHUB_TOKEN }}
352+
353+
- name: Decompress ccache archive
354+
continue-on-error: true
355+
shell: bash
356+
run: |
357+
tar xzf ttk-sccache.tar.gz
358+
mkdir -p /c/Users/runneradmin/AppData/Local/Mozilla/sccache
359+
mv cache /c/Users/runneradmin/AppData/Local/Mozilla/sccache
360+
338361
- name: Fetch TTK-ParaView headless Windows installer
339362
run: |
340363
Invoke-WebRequest `
@@ -350,11 +373,19 @@ jobs:
350373
shell: cmd
351374
run: |
352375
set CMAKE_PREFIX_PATH=%CONDA_ROOT%\Library\lib\cmake;%CONDA_ROOT%\Library\share\eigen3\cmake;%CONDA_ROOT%\Library\cmake;%ProgramFiles%\TTK-ParaView\lib\cmake
376+
set CC=clang-cl.exe
377+
set CXX=clang-cl.exe
378+
call "%ProgramFiles%\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
379+
sccache --stop-server
380+
sccache --start-server
353381
mkdir build
354382
cd build
355383
cmake ^
384+
-DCMAKE_BUILD_TYPE=Release ^
356385
-DCMAKE_POLICY_DEFAULT_CMP0092=NEW ^
357386
-DBUILD_SHARED_LIBS:BOOL=TRUE ^
387+
-DCMAKE_C_COMPILER_LAUNCHER=sccache ^
388+
-DCMAKE_CXX_COMPILER_LAUNCHER=sccache ^
358389
-DPython3_ROOT_DIR="%CONDA_ROOT%" ^
359390
-DGraphviz_INCLUDE_DIR="%CONDA_ROOT%\Library\include\graphviz" ^
360391
-DGraphviz_CDT_LIBRARY="%CONDA_ROOT%\Library\lib\cdt.lib" ^
@@ -369,40 +400,48 @@ jobs:
369400
-DTTK_ENABLE_CPU_OPTIMIZATION=FALSE ^
370401
-DTTK_ENABLE_SHARED_BASE_LIBRARIES=TRUE ^
371402
-DTTK_IMPLICIT_PRECONDITIONS_THRESHOLD=64*64*64 ^
372-
-G"Visual Studio 17 2022" ^
373-
-Tclangcl ^
403+
-GNinja ^
374404
..
375405
376-
- name: Build & install TTK
406+
- name: Fix clang-cl OpenMP flags in build.ninja
377407
shell: bash
408+
run: |
409+
sed -i 's/-Xclang -fopenmp/-openmp/' build/build.ninja
410+
411+
- name: Build & install TTK
412+
shell: cmd
378413
run: |
379414
cd build
415+
call "%ProgramFiles%\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
380416
cmake --build . --config Release --parallel --target install
381-
# set PATH environment variable
382-
echo "$PV_DIR/bin" >> $GITHUB_PATH
383-
echo "$TTK_DIR/bin" >> $GITHUB_PATH
384417
385418
- name: Test C++ example
386419
shell: cmd
387420
run: |
421+
set CC=clang-cl.exe
422+
set CXX=clang-cl.exe
423+
call "%ProgramFiles%\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
388424
set CMAKE_PREFIX_PATH=%TTK_DIR%\lib\cmake;%PV_DIR%\lib\cmake
389425
cd %GITHUB_WORKSPACE%\examples\c++
390426
mkdir build
391427
cd build
392-
cmake -G"Visual Studio 17 2022" -Tclangcl ..
428+
cmake -DCMAKE_BUILD_TYPE=Release -GNinja ..
393429
cmake --build . --config Release --parallel
394-
Release\ttkExample-c++.exe -i ..\..\data\inputData.off
430+
ttkExample-c++.exe -i ..\..\data\inputData.off
395431
396432
- name: Test VTK-C++ example
397433
shell: cmd
398434
run: |
435+
set CC=clang-cl.exe
436+
set CXX=clang-cl.exe
437+
call "%ProgramFiles%\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
399438
set CMAKE_PREFIX_PATH=%TTK_DIR%\lib\cmake;%PV_DIR%\lib\cmake
400439
cd %GITHUB_WORKSPACE%\examples\vtk-c++
401440
mkdir build
402441
cd build
403-
cmake -G"Visual Studio 17 2022" -Tclangcl ..
442+
cmake -DCMAKE_BUILD_TYPE=Release -GNinja ..
404443
cmake --build . --config Release --parallel
405-
Release\ttkExample-vtk-c++.exe -i ..\..\data\inputData.vtu
444+
ttkExample-vtk-c++.exe -i ..\..\data\inputData.vtu
406445
407446
- name: Test Python example
408447
shell: cmd

core/base/lDistanceMatrix/LDistanceMatrix.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,7 @@ int ttk::LDistanceMatrix::execute(std::vector<std::vector<double>> &output,
5353

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

0 commit comments

Comments
 (0)