From 161069bd619d0c1ac4f200214163ff7d5191ccc8 Mon Sep 17 00:00:00 2001 From: Aiden Woodruff Date: Mon, 23 Jun 2025 13:21:50 -0400 Subject: [PATCH 01/24] add ccache to Github CI - add ccache config in jobs.build.env. - limit cache size to 200mb for now. - compression can also be recomputed at the end with -X - add ccache setup and ccache action (not sure if I will need to change to explicit restore/save). - add CMake ccache argument to config for normal build and examples. - remove --config from the build step because ninja is a single config builder. - reflow strings for the example projects - for mpi-nompi example set c_compiler to be safe. Signed-off-by: Aiden Woodruff --- .github/workflows/cmake.yml | 55 ++++++++++++++++++++++++++++++++----- 1 file changed, 48 insertions(+), 7 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 6580569e7..a36afdf97 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -18,6 +18,11 @@ jobs: no_mpi: [OFF, ON] cxx_standard: [11, 20] metis: [OFF, ON] + env: + CCACHE_DIR: ${{github.workspace}} + CCACHE_BASEDIR: ${{github.workspace}}/.ccache + CCACHE_COMPRESS: true + CCACHE_MAXSIZE: 200M steps: - uses: actions/checkout@v4 @@ -32,6 +37,21 @@ jobs: if: matrix.metis == 'ON' run: sudo apt install libmetis-dev + - name: setup ccache + id: setup-ccache + run: | + sudo apt install ccache + ccache -p # Print ccache config + ccache -z # Zero ccache statistics + echo ::set-output name=key::$(date -u '+%Y-%m-%dT%T') + + - name: ccache + uses: actions/cache@v4 + with: + path: ${{github.workspace}}/.ccache + key: ${{matrix.compiler.name}}-ccache-${{steps.setup-ccache.outputs.timestamp}} + restore-keys: ${{matrix.compiler.name}}-ccache- + - name: Configure CMake env: MPICH_CXX: ${{matrix.compiler.CXX}} @@ -41,6 +61,8 @@ jobs: -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/build/install -GNinja -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_BUILD_TYPE=${{matrix.build_type}} + -DCMAKE_C_COMPILER_LAUNCHER=ccache + -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER=mpicxx -DCMAKE_C_COMPILER=mpicc -DCMAKE_CXX_STANDARD=${{matrix.cxx_standard}} -DSCOREC_CXX_WARNINGS=ON @@ -53,7 +75,10 @@ jobs: env: MPICH_CXX: ${{matrix.compiler.CXX}} MPICH_CC: ${{matrix.compiler.CC}} - run: cmake --build ${{github.workspace}}/build --config ${{matrix.build_type}} -j --target install + run: | + cmake + --build ${{github.workspace}}/build + --target install - name: Test env: @@ -68,8 +93,16 @@ jobs: env: MPICH_CXX: ${{matrix.compiler.CXX}} MPICH_CC: ${{matrix.compiler.CC}} - run: | - cmake -S ${{github.workspace}}/doc -B ${{github.workspace}}/buildExample -DCMAKE_CXX_COMPILER=mpicxx -DSCOREC_PREFIX=${{github.workspace}}/build/install + run: > + cmake + -S ${{github.workspace}}/doc + -B ${{github.workspace}}/buildExample + -DCMAKE_C_COMPILER_LAUNCHER=ccache + -DCMAKE_CXX_COMPILER_LAUNCHER=ccache + -DCMAKE_C_COMPILER=mpicc + -DCMAKE_CXX_COMPILER=mpicxx + -DSCOREC_PREFIX=${{github.workspace}}/build/install + ; cmake --build ${{github.workspace}}/buildExample - name: Build MPI-NoMPI Example @@ -81,10 +114,18 @@ jobs: MPICH_CXX: ${{matrix.compiler.CXX}} MPICH_CC: ${{matrix.compiler.CC}} run: > - cmake -S ${{github.workspace}}/example/mpi-nompi - -B ${{github.workspace}}/example/mpi-nompi/build - -DCMAKE_CXX_COMPILER=mpicxx - -DSCOREC_PREFIX=${{github.workspace}}/build/install ; + cmake + -S ${{github.workspace}}/example/mpi-nompi + -B ${{github.workspace}}/example/mpi-nompi/build + -DCMAKE_C_COMPILER_LAUNCHER=ccache + -DCMAKE_CXX_COMPILER_LAUNCHER=ccache + -DCMAKE_C_COMPILER=mpicxx + -DCMAKE_CXX_COMPILER=mpicxx + -DSCOREC_PREFIX=${{github.workspace}}/build/install + ; cmake --build ${{github.workspace}}/example/mpi-nompi/build ; ctest --test-dir ${{github.workspace}}/example/mpi-nompi/build --output-on-failure + + - name: CCache statistics + run: cmake -sv From aca94faead5f7a153af61b5c7e15c5c74867d096 Mon Sep 17 00:00:00 2001 From: Aiden Woodruff Date: Mon, 23 Jun 2025 13:29:49 -0400 Subject: [PATCH 02/24] use $GITHUB_OUTPUT and fix yaml flow - new $GITHUB_OUTPUT is preferred and ::set-output is deprecated - reflow jobs.build.steps.build.run to one line now that extra options are removed. Signed-off-by: Aiden Woodruff --- .github/workflows/cmake.yml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index a36afdf97..ce73491d4 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -43,7 +43,7 @@ jobs: sudo apt install ccache ccache -p # Print ccache config ccache -z # Zero ccache statistics - echo ::set-output name=key::$(date -u '+%Y-%m-%dT%T') + echo timestamp=$(date -u '+%Y-%m-%dT%T') >> "$GITHUB_OUTPUT" - name: ccache uses: actions/cache@v4 @@ -75,10 +75,7 @@ jobs: env: MPICH_CXX: ${{matrix.compiler.CXX}} MPICH_CC: ${{matrix.compiler.CC}} - run: | - cmake - --build ${{github.workspace}}/build - --target install + run: cmake --build ${{github.workspace}}/build --target install - name: Test env: From d476ff63057299847d1241475c1eb1aff40049b7 Mon Sep 17 00:00:00 2001 From: Aiden Woodruff Date: Mon, 23 Jun 2025 13:46:26 -0400 Subject: [PATCH 03/24] fix ccache statistics command typo Signed-off-by: Aiden Woodruff --- .github/workflows/cmake.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index ce73491d4..ae1b6f85a 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -125,4 +125,4 @@ jobs: --output-on-failure - name: CCache statistics - run: cmake -sv + run: ccache -sv From 6ca097db0ce556a0d9ecb9914d69dd3aae3da4a1 Mon Sep 17 00:00:00 2001 From: Aiden Woodruff Date: Mon, 23 Jun 2025 14:07:30 -0400 Subject: [PATCH 04/24] fix ccache config flags and try to fix strings - ccache_dir should be the actual location of the cache, while basedir should be the root path for all files. - Not sure if the github actions yaml parser is non-standard, but extra indentation seemed to be screwing up the multiline strings. try to fix and join some related lines Signed-off-by: Aiden Woodruff --- .github/workflows/cmake.yml | 29 +++++++++++------------------ 1 file changed, 11 insertions(+), 18 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index ae1b6f85a..2ffa2fd88 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -19,8 +19,8 @@ jobs: cxx_standard: [11, 20] metis: [OFF, ON] env: - CCACHE_DIR: ${{github.workspace}} - CCACHE_BASEDIR: ${{github.workspace}}/.ccache + CCACHE_DIR: ${{github.workspace}}/.ccache + CCACHE_BASEDIR: ${{github.workspace}} CCACHE_COMPRESS: true CCACHE_MAXSIZE: 200M @@ -92,14 +92,10 @@ jobs: MPICH_CC: ${{matrix.compiler.CC}} run: > cmake - -S ${{github.workspace}}/doc - -B ${{github.workspace}}/buildExample - -DCMAKE_C_COMPILER_LAUNCHER=ccache - -DCMAKE_CXX_COMPILER_LAUNCHER=ccache - -DCMAKE_C_COMPILER=mpicc - -DCMAKE_CXX_COMPILER=mpicxx - -DSCOREC_PREFIX=${{github.workspace}}/build/install - ; + -S ${{github.workspace}}/doc -B ${{github.workspace}}/buildExample + -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache + -DCMAKE_C_COMPILER=mpicc -DCMAKE_CXX_COMPILER=mpicxx + -DSCOREC_PREFIX=${{github.workspace}}/build/install ; cmake --build ${{github.workspace}}/buildExample - name: Build MPI-NoMPI Example @@ -112,14 +108,11 @@ jobs: MPICH_CC: ${{matrix.compiler.CC}} run: > cmake - -S ${{github.workspace}}/example/mpi-nompi - -B ${{github.workspace}}/example/mpi-nompi/build - -DCMAKE_C_COMPILER_LAUNCHER=ccache - -DCMAKE_CXX_COMPILER_LAUNCHER=ccache - -DCMAKE_C_COMPILER=mpicxx - -DCMAKE_CXX_COMPILER=mpicxx - -DSCOREC_PREFIX=${{github.workspace}}/build/install - ; + -S ${{github.workspace}}/example/mpi-nompi + -B ${{github.workspace}}/example/mpi-nompi/build + -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache + -DCMAKE_C_COMPILER=mpicxx -DCMAKE_CXX_COMPILER=mpicxx + -DSCOREC_PREFIX=${{github.workspace}}/build/install ; cmake --build ${{github.workspace}}/example/mpi-nompi/build ; ctest --test-dir ${{github.workspace}}/example/mpi-nompi/build --output-on-failure From 8d26de6ebe53c0ca95d1708b85b71910c4fb16db Mon Sep 17 00:00:00 2001 From: Aiden Woodruff Date: Mon, 23 Jun 2025 14:18:43 -0400 Subject: [PATCH 05/24] commit to test cache restore - use apt-get (which has a more stable CLI interface) instead of apt. Signed-off-by: Aiden Woodruff --- .github/workflows/cmake.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 2ffa2fd88..4f2d222f2 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -40,7 +40,7 @@ jobs: - name: setup ccache id: setup-ccache run: | - sudo apt install ccache + sudo apt-get install ccache ccache -p # Print ccache config ccache -z # Zero ccache statistics echo timestamp=$(date -u '+%Y-%m-%dT%T') >> "$GITHUB_OUTPUT" From 1e36ab9899fd72cb7f98dcf048fca3bd6b5e5b5b Mon Sep 17 00:00:00 2001 From: Aiden Woodruff Date: Mon, 23 Jun 2025 14:34:21 -0400 Subject: [PATCH 06/24] refine ccache key - add c++ version and build type to cache key parameters. - higher cache hits decreases build time significantly, so always try to get the most relevant one. - reduce cache maxsize since the number of caches will increase Signed-off-by: Aiden Woodruff --- .github/workflows/cmake.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 4f2d222f2..11a34ba2e 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -22,7 +22,7 @@ jobs: CCACHE_DIR: ${{github.workspace}}/.ccache CCACHE_BASEDIR: ${{github.workspace}} CCACHE_COMPRESS: true - CCACHE_MAXSIZE: 200M + CCACHE_MAXSIZE: 100M steps: - uses: actions/checkout@v4 @@ -49,8 +49,14 @@ jobs: uses: actions/cache@v4 with: path: ${{github.workspace}}/.ccache - key: ${{matrix.compiler.name}}-ccache-${{steps.setup-ccache.outputs.timestamp}} - restore-keys: ${{matrix.compiler.name}}-ccache- + key: "${{matrix.compiler.name}}-\ + ${{matrix.cxx_standard}}-\ + ${{matrix.build_type}}-\ + ccache-${{steps.setup-ccache.outputs.timestamp}}" + restore-keys: "${{matrix.compiler.name}}-\ + ${{matrix.cxx_standard}}-\ + ${{matrix.build_type}}-\ + ccache-" - name: Configure CMake env: From 5f217380d7055bcf3fffa288e8c5b28f6e7f7a82 Mon Sep 17 00:00:00 2001 From: Aiden Woodruff Date: Mon, 23 Jun 2025 14:51:38 -0400 Subject: [PATCH 07/24] empty commit to test cache hits Signed-off-by: Aiden Woodruff From 3e5cc593e735da7449cc31d6679e657e237ea8f4 Mon Sep 17 00:00:00 2001 From: Aiden Woodruff Date: Mon, 23 Jun 2025 15:03:17 -0400 Subject: [PATCH 08/24] add nompi to ccache key - whether or not nompi is enabled significantly affects compilation, since it's exposed in SCOREC_config.h as well as changing what happens in pcu/pcu_defines.h - add cxx: prefix to the cxx_standard to make the key more readable. - add new key as a second option to ensure that old caches can be used. - next commit will remove old form. Signed-off-by: Aiden Woodruff --- .github/workflows/cmake.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 11a34ba2e..51331de34 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -50,12 +50,18 @@ jobs: with: path: ${{github.workspace}}/.ccache key: "${{matrix.compiler.name}}-\ - ${{matrix.cxx_standard}}-\ + cxx:${{matrix.cxx_standard}}-\ ${{matrix.build_type}}-\ + nompi:${{matrix.no_mpi}}-\ ccache-${{steps.setup-ccache.outputs.timestamp}}" restore-keys: "${{matrix.compiler.name}}-\ ${{matrix.cxx_standard}}-\ ${{matrix.build_type}}-\ + ccache-\n\ + cxx:${{matrix.compiler.name}}-\ + ${{matrix.cxx_standard}}-\ + ${{matrix.build_type}}-\ + nompi:${{matrix.no_mpi}}-\ ccache-" - name: Configure CMake From 1c1b23c4953fb661f0db71ed35a24ca1467caccf Mon Sep 17 00:00:00 2001 From: Aiden Woodruff Date: Mon, 23 Jun 2025 15:16:16 -0400 Subject: [PATCH 09/24] remove old cache key and parallel ctest - remove old cache key and only use new one. - make ctest run in parallel. the nprocs script should be available as it is included with coreutils. Signed-off-by: Aiden Woodruff --- .github/workflows/cmake.yml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 51331de34..a830a2c3e 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -55,11 +55,7 @@ jobs: nompi:${{matrix.no_mpi}}-\ ccache-${{steps.setup-ccache.outputs.timestamp}}" restore-keys: "${{matrix.compiler.name}}-\ - ${{matrix.cxx_standard}}-\ - ${{matrix.build_type}}-\ - ccache-\n\ - cxx:${{matrix.compiler.name}}-\ - ${{matrix.cxx_standard}}-\ + cxx:${{matrix.cxx_standard}}-\ ${{matrix.build_type}}-\ nompi:${{matrix.no_mpi}}-\ ccache-" @@ -94,7 +90,7 @@ jobs: MPICH_CXX: ${{matrix.compiler.CXX}} MPICH_CC: ${{matrix.compiler.CC}} working-directory: ${{github.workspace}}/build - run: ctest --output-on-failure -C ${{matrix.build_type}} + run: ctest --output-on-failure -j $(nprocs) - name: Build User Project # only need to test with a single build config if the installed cmake config files work From 65052ba84b98767a676e3c9fc6fe919add7d9cf1 Mon Sep 17 00:00:00 2001 From: Aiden Woodruff Date: Mon, 23 Jun 2025 15:25:37 -0400 Subject: [PATCH 10/24] revert parallel CTest - not only is nprocs missing, but the DEPENDS property isn't good enough. Signed-off-by: Aiden Woodruff --- .github/workflows/cmake.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index a830a2c3e..a567adc2d 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -90,7 +90,7 @@ jobs: MPICH_CXX: ${{matrix.compiler.CXX}} MPICH_CC: ${{matrix.compiler.CC}} working-directory: ${{github.workspace}}/build - run: ctest --output-on-failure -j $(nprocs) + run: ctest --output-on-failure - name: Build User Project # only need to test with a single build config if the installed cmake config files work From 7d973c6ce8a924f0a938d453f19eebce45d9e486 Mon Sep 17 00:00:00 2001 From: Aiden Woodruff Date: Mon, 23 Jun 2025 15:45:07 -0400 Subject: [PATCH 11/24] add cache cleanup workflow and recompress - .github/workflows/cmake.yml: recompress cache before sending. - this may or may not help since zstd is already used by the cache action. - .github/workflows/cleanup-caches.yml: add from documentation to cleanup 100 caches on PR close. Signed-off-by: Aiden Woodruff --- .github/workflows/cleanup-caches.yml | 28 ++++++++++++++++++++++++++++ .github/workflows/cmake.yml | 7 +++++-- 2 files changed, 33 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/cleanup-caches.yml diff --git a/.github/workflows/cleanup-caches.yml b/.github/workflows/cleanup-caches.yml new file mode 100644 index 000000000..dc716023e --- /dev/null +++ b/.github/workflows/cleanup-caches.yml @@ -0,0 +1,28 @@ +name: Cleanup caches on closed PRs +# From https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/caching-dependencies-to-speed-up-workflows#matching-a-cache-key +on: + pull_request: + types: [ closed ] +jobs: + cleanup: + runs-on: ubuntu-latest + permissions: + actions: write + steps: + - name: Cleanup + run: | + echo "Fetching list of cache keys" + cacheKeysForPR=$(gh cache list --ref $BRANCH --limit 100 --json id --jq '.[].id') + + ## Setting this to not fail the workflow while deleting cache keys. + set +e + echo "Deleting caches..." + for cacheKey in $cacheKeysForPR + do + gh cache delete $cacheKey + done + echo "Done" + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GH_REPO: ${{ github.repository }} + BRANCH: refs/pull/${{ github.event.pull_request.number }}/merge diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index a567adc2d..88b07c27c 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -125,5 +125,8 @@ jobs: ctest --test-dir ${{github.workspace}}/example/mpi-nompi/build --output-on-failure - - name: CCache statistics - run: ccache -sv + - name: CCache statistics and recompression + run: | + ccache -sv + CCACHE_COMPRESSLEVEL=5 ccache -X + From 870e92ae39a315e045e302096243f37421e276f8 Mon Sep 17 00:00:00 2001 From: Aiden Woodruff Date: Mon, 23 Jun 2025 16:01:08 -0400 Subject: [PATCH 12/24] add paths: check and fix typos - .github/workflows/cleanup-caches.yml: replace tabs with spaces. - .github/workflows/cmake.yml: add paths that will trigger runs. - fix ccache recompression arguments. Signed-off-by: Aiden Woodruff --- .github/workflows/cleanup-caches.yml | 2 +- .github/workflows/cmake.yml | 13 ++++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cleanup-caches.yml b/.github/workflows/cleanup-caches.yml index dc716023e..2f666007a 100644 --- a/.github/workflows/cleanup-caches.yml +++ b/.github/workflows/cleanup-caches.yml @@ -8,7 +8,7 @@ jobs: runs-on: ubuntu-latest permissions: actions: write - steps: + steps: - name: Cleanup run: | echo "Fetching list of cache keys" diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 88b07c27c..798d33956 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -4,6 +4,17 @@ on: branches: [ develop ] pull_request: branches: [ develop ] + paths: + - .github/workflows/cmake.yml + - .gitmodules + - '**/CMakeLists.txt' + - '**/*.cmake' + - '**/*.in' + - '**/*.h' + - '**/*.c' + - '**/*.cc' + - '**/*.cpp' + - '**/*.f' jobs: build: # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix @@ -128,5 +139,5 @@ jobs: - name: CCache statistics and recompression run: | ccache -sv - CCACHE_COMPRESSLEVEL=5 ccache -X + ccache -X 5 From 133892035fca02806e7581d72900fa96d8eb6611 Mon Sep 17 00:00:00 2001 From: Aiden Woodruff Date: Mon, 23 Jun 2025 17:21:35 -0400 Subject: [PATCH 13/24] download latest ccache version - could not find local differences to explain cache misses, but the version on ubuntu 22.04 is 4.5.1 and the latest is 4.11. 3 years might make a difference. Signed-off-by: Aiden Woodruff --- .github/workflows/cmake.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 798d33956..151c65ec9 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -50,8 +50,14 @@ jobs: - name: setup ccache id: setup-ccache + with: + ccache_version: 4.11.3 + # Download latest version as of 2025-06-23 run: | - sudo apt-get install ccache + wget https://github.com/ccache/ccache/releases/download/v${{ccache_version}}/ccache-${{ccache_version}}-linux-x86_64.tar.xz + tar xf ccache-${{ccache_version}}-linux-x86_64.tar.xz + cd ccache-${{ccache_version}}-linux-x86_64 + sudo make install ccache -p # Print ccache config ccache -z # Zero ccache statistics echo timestamp=$(date -u '+%Y-%m-%dT%T') >> "$GITHUB_OUTPUT" From 52988723fbed5fd9fcb317cd823c6664b2194867 Mon Sep 17 00:00:00 2001 From: Aiden Woodruff Date: Mon, 23 Jun 2025 17:26:23 -0400 Subject: [PATCH 14/24] replace `with` with `env` - with is only for reusable workflows. Signed-off-by: Aiden Woodruff --- .github/workflows/cmake.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 151c65ec9..3933ba577 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -50,13 +50,13 @@ jobs: - name: setup ccache id: setup-ccache - with: - ccache_version: 4.11.3 + env: + CCACHE_VERSION: 4.11.3 # Download latest version as of 2025-06-23 run: | - wget https://github.com/ccache/ccache/releases/download/v${{ccache_version}}/ccache-${{ccache_version}}-linux-x86_64.tar.xz - tar xf ccache-${{ccache_version}}-linux-x86_64.tar.xz - cd ccache-${{ccache_version}}-linux-x86_64 + wget https://github.com/ccache/ccache/releases/download/v${CCACHE_VERSION}/ccache-${CCACHE_VERSION}-linux-x86_64.tar.xz + tar xf ccache-${CCACHE_VERSION}-linux-x86_64.tar.xz + cd ccache-${CCACHE_VERSION}-linux-x86_64 sudo make install ccache -p # Print ccache config ccache -z # Zero ccache statistics From 0e0c707e1dd4a1f14850c0adfdb5328cd825b4b2 Mon Sep 17 00:00:00 2001 From: Aiden Woodruff Date: Mon, 23 Jun 2025 17:28:35 -0400 Subject: [PATCH 15/24] move clear cache statistics after cache restore - ccache 4.7 changed the cache format so the old caches are incompatible. - also, clear the statistics after loading. I think that maybe was causing incorrect statistics. Signed-off-by: Aiden Woodruff --- .github/workflows/cmake.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 3933ba577..0c27a7bfe 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -59,7 +59,6 @@ jobs: cd ccache-${CCACHE_VERSION}-linux-x86_64 sudo make install ccache -p # Print ccache config - ccache -z # Zero ccache statistics echo timestamp=$(date -u '+%Y-%m-%dT%T') >> "$GITHUB_OUTPUT" - name: ccache @@ -77,6 +76,9 @@ jobs: nompi:${{matrix.no_mpi}}-\ ccache-" + - name: Clear ccache statistics + run: ccache -z + - name: Configure CMake env: MPICH_CXX: ${{matrix.compiler.CXX}} From 8a3eab998b84ccb25f6783b9f9a0476d2eb6261a Mon Sep 17 00:00:00 2001 From: Aiden Woodruff Date: Mon, 23 Jun 2025 17:36:05 -0400 Subject: [PATCH 16/24] revert to default ccache version Signed-off-by: Aiden Woodruff --- .github/workflows/cmake.yml | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 0c27a7bfe..afb2afa9c 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -50,14 +50,8 @@ jobs: - name: setup ccache id: setup-ccache - env: - CCACHE_VERSION: 4.11.3 - # Download latest version as of 2025-06-23 run: | - wget https://github.com/ccache/ccache/releases/download/v${CCACHE_VERSION}/ccache-${CCACHE_VERSION}-linux-x86_64.tar.xz - tar xf ccache-${CCACHE_VERSION}-linux-x86_64.tar.xz - cd ccache-${CCACHE_VERSION}-linux-x86_64 - sudo make install + sudo apt-get install ccache ccache -p # Print ccache config echo timestamp=$(date -u '+%Y-%m-%dT%T') >> "$GITHUB_OUTPUT" From 8013a7e3e3d5b470a5fbfa9263e9ce51572c57e3 Mon Sep 17 00:00:00 2001 From: Aiden Woodruff Date: Mon, 23 Jun 2025 17:48:02 -0400 Subject: [PATCH 17/24] add ninja and ccache to python-api-test - .github/workflows/python-api-test.yml: add ccache settings. - add ccache to the Zoltan and PUMI builds (typically the longest steps). - might need to use ccache-swig instead which is built by the swig library. Signed-off-by: Aiden Woodruff --- .github/workflows/python-api-test.yml | 36 ++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 4 deletions(-) diff --git a/.github/workflows/python-api-test.yml b/.github/workflows/python-api-test.yml index 2d2d645b0..6eb1c0892 100644 --- a/.github/workflows/python-api-test.yml +++ b/.github/workflows/python-api-test.yml @@ -13,6 +13,10 @@ jobs: env: PYTHONPATH: ${{ github.workspace }}/build/python_wrappers LD_LIBRARY_PATH: ${{ github.workspace }}/libs/install/lib:${LD_LIBRARY_PATH} + CCACHE_DIR: ${{github.workspace}}/.ccache + CCACHE_BASEDIR: ${{github.workspace}} + CCACHE_COMPRESS: true + CCACHE_MAXSIZE: 100M steps: - name: Checkout repository @@ -21,9 +25,23 @@ jobs: - name: Install dependencies run: | sudo apt-get update - sudo apt-get install -y cmake mpich build-essential libbz2-dev + sudo apt-get install -y cmake mpich build-essential libbz2-dev ccache pip3 install mpi4py - + + - name: setup ccache + id: setup-ccache + run: | + ccache -p # Print ccache config + echo timestamp=$(date -u '+%Y-%m-%dT%T') >> "$GITHUB_OUTPUT" + - name: ccache + uses: actions/cache@v4 + with: + path: ${{github.workspace}}/.ccache + key: "pyapi-ccache-${{steps.setup-ccache.outputs.timestamp}}" + restore-keys: "pyapi-ccache-" + - name: Clear ccache statistics + run: ccache -z + - name: Build SWIG run: | git clone https://github.com/swig/swig.git @@ -62,6 +80,8 @@ jobs: cmake ../Trilinos \ -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/libs/install \ -DTPL_ENABLE_MPI:BOOL=ON \ + -DCMAKE_C_COMPILER_LAUNCHER=ccache \ + -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ -DCMAKE_C_FLAGS="-O3 -fPIC" \ -DCMAKE_CXX_FLAGS="-O3 -fPIC" \ -DTrilinos_ENABLE_ALL_PACKAGES:BOOL=OFF \ @@ -77,7 +97,10 @@ jobs: - name: Configure PUMI run: | cmake -S . -B build \ + -GNinja \ -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/build/install \ + -DCMAKE_C_COMPILER_LAUNCHER=ccache \ + -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ -DCMAKE_C_COMPILER=mpicc \ -DCMAKE_CXX_COMPILER=mpicxx \ -DSCOREC_CXX_OPTIMIZE=ON \ @@ -93,11 +116,16 @@ jobs: -DPARMETIS_PREFIX=${{ github.workspace }}/libs/install \ -DENABLE_SIMMETRIX=OFF - - name: Build and install + - name: Build and install PUMI run: | - cmake --build build -j 4 --target install + cmake --build build --target install - name: Run Python test working-directory: ${{github.workspace}}/python_wrappers run: | python3 test_pyCore.py -g input/cube.dmg -m input/cube.smb + + - name: Ccache statistics and recompression + run: | + ccache -sv + ccache -X 5 From 194c7e893cdca34ba8e108e3717b0bcb0b71c7a6 Mon Sep 17 00:00:00 2001 From: Aiden Woodruff Date: Mon, 23 Jun 2025 18:07:11 -0400 Subject: [PATCH 18/24] use ninja for python api trilinos build - also do shallow clone Signed-off-by: Aiden Woodruff --- .github/workflows/python-api-test.yml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/workflows/python-api-test.yml b/.github/workflows/python-api-test.yml index 6eb1c0892..0f23c4957 100644 --- a/.github/workflows/python-api-test.yml +++ b/.github/workflows/python-api-test.yml @@ -74,10 +74,9 @@ jobs: - name: Build Zoltan from Trilinos (minimal) run: | - git clone https://github.com/trilinos/Trilinos.git - mkdir build-zoltan - cd build-zoltan - cmake ../Trilinos \ + git clone --depth 1 https://github.com/trilinos/Trilinos.git + cmake -S Trilinos -b build-zoltan \ + -GNinja \ -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/libs/install \ -DTPL_ENABLE_MPI:BOOL=ON \ -DCMAKE_C_COMPILER_LAUNCHER=ccache \ @@ -91,8 +90,7 @@ jobs: -DZoltan_ENABLE_ParMETIS:BOOL=ON \ -DParMETIS_INCLUDE_DIRS=${{ github.workspace }}/libs/install \ -DParMETIS_LIBRARY_DIRS=${{ github.workspace }}/libs/install - make - make install + cmake --build build-zoltan -t install - name: Configure PUMI run: | From fff578a2a2ba3eb50442425f1b06a86ebfbb752a Mon Sep 17 00:00:00 2001 From: Aiden Woodruff Date: Mon, 23 Jun 2025 18:17:16 -0400 Subject: [PATCH 19/24] fix pyapi workflow typo - remove build-essential from list. probably not causing any of the long install time problems (mpich and dependencies are at fault) but it should not be necessary as a meta-package since all it's depdendencies are installed by default. - remove cmake from the install list as it's also available by default. - fix cmake configure typo. Signed-off-by: Aiden Woodruff --- .github/workflows/python-api-test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/python-api-test.yml b/.github/workflows/python-api-test.yml index 0f23c4957..6f4cf84f4 100644 --- a/.github/workflows/python-api-test.yml +++ b/.github/workflows/python-api-test.yml @@ -25,7 +25,7 @@ jobs: - name: Install dependencies run: | sudo apt-get update - sudo apt-get install -y cmake mpich build-essential libbz2-dev ccache + sudo apt-get install -y mpich libbz2-dev ccache pip3 install mpi4py - name: setup ccache @@ -75,7 +75,7 @@ jobs: - name: Build Zoltan from Trilinos (minimal) run: | git clone --depth 1 https://github.com/trilinos/Trilinos.git - cmake -S Trilinos -b build-zoltan \ + cmake -S Trilinos -B build-zoltan \ -GNinja \ -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/libs/install \ -DTPL_ENABLE_MPI:BOOL=ON \ From 998d15cef9bee620ba9be2fa6dd7077ed8adca97 Mon Sep 17 00:00:00 2001 From: Aiden Woodruff Date: Mon, 23 Jun 2025 18:24:32 -0400 Subject: [PATCH 20/24] add pip cache - the install dependencies step took a long time because of pip! - add cache for pip. - add step to get single timestamp for both caches. Signed-off-by: Aiden Woodruff --- .github/workflows/python-api-test.yml | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/.github/workflows/python-api-test.yml b/.github/workflows/python-api-test.yml index 6f4cf84f4..842a753df 100644 --- a/.github/workflows/python-api-test.yml +++ b/.github/workflows/python-api-test.yml @@ -22,25 +22,34 @@ jobs: - name: Checkout repository uses: actions/checkout@v3 + - name: setup cache timestamp + id: setup-cache + run: | + echo timestamp=$(date -u '+%Y-%m-%dT%T') >> "$GITHUB_OUTPUT" + + - name: Cache pip + uses: actions/cache@v4 + with: + path: ~/.cache/pip + key: "pyapi-pip-${{steps.setup-cache.outputs.timestamp}}" + restore-keys: pyapi-pip- + - name: Install dependencies run: | sudo apt-get update sudo apt-get install -y mpich libbz2-dev ccache pip3 install mpi4py - - name: setup ccache - id: setup-ccache - run: | - ccache -p # Print ccache config - echo timestamp=$(date -u '+%Y-%m-%dT%T') >> "$GITHUB_OUTPUT" - name: ccache uses: actions/cache@v4 with: path: ${{github.workspace}}/.ccache - key: "pyapi-ccache-${{steps.setup-ccache.outputs.timestamp}}" + key: "pyapi-ccache-${{steps.setup-cache.outputs.timestamp}}" restore-keys: "pyapi-ccache-" - name: Clear ccache statistics - run: ccache -z + run: | + ccache -p # Print ccache config + ccache -z - name: Build SWIG run: | From d62e739a8002b4b235e4a8893cba5f5c5d9da3f2 Mon Sep 17 00:00:00 2001 From: Aiden Woodruff Date: Mon, 23 Jun 2025 18:41:11 -0400 Subject: [PATCH 21/24] add ccache for pyapi swig build - allow ccache to masquerade as the compiler for swig build. - same method used by the action hendrikmuhs/ccache-action in https://github.com/swig/swig/blob/1f8684eb540d5d7c63fe7d5c3853990dd2316999/.github/workflows/linux.yml Signed-off-by: Aiden Woodruff --- .github/workflows/python-api-test.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/python-api-test.yml b/.github/workflows/python-api-test.yml index 842a753df..c8b0c8481 100644 --- a/.github/workflows/python-api-test.yml +++ b/.github/workflows/python-api-test.yml @@ -38,6 +38,11 @@ jobs: run: | sudo apt-get update sudo apt-get install -y mpich libbz2-dev ccache + sudo mkdir -p /usr/local/opt/ccache/libexec + sudo ln -s $(which ccache) /usr/local/opt/ccache/libexec/gcc + sudo ln -s $(which ccache) /usr/local/opt/ccache/libexec/g++ + sudo ln -s $(which ccache) /usr/local/opt/ccache/libexec/cc + sudo ln -s $(which ccache) /usr/local/opt/ccache/libexec/c++ pip3 install mpi4py - name: ccache @@ -46,6 +51,7 @@ jobs: path: ${{github.workspace}}/.ccache key: "pyapi-ccache-${{steps.setup-cache.outputs.timestamp}}" restore-keys: "pyapi-ccache-" + - name: Clear ccache statistics run: | ccache -p # Print ccache config @@ -55,6 +61,7 @@ jobs: run: | git clone https://github.com/swig/swig.git cd swig + export PATH=/usr/local/opt/ccache/libexec:$PATH ./autogen.sh ./configure --prefix=${{ github.workspace }}/libs/install make From def4bcc782c3da42c6eab65639631439d298e577 Mon Sep 17 00:00:00 2001 From: Aiden Woodruff Date: Mon, 23 Jun 2025 18:49:37 -0400 Subject: [PATCH 22/24] use ccache for gklib/metis/parmetis in pyapi ci - use the top level env instead of adding to each config. - gklib/metis/parmetis are secretly cmake but they have a make config. using the environmental variable should still reach cmake. Signed-off-by: Aiden Woodruff --- .github/workflows/python-api-test.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/python-api-test.yml b/.github/workflows/python-api-test.yml index c8b0c8481..832d51305 100644 --- a/.github/workflows/python-api-test.yml +++ b/.github/workflows/python-api-test.yml @@ -17,6 +17,8 @@ jobs: CCACHE_BASEDIR: ${{github.workspace}} CCACHE_COMPRESS: true CCACHE_MAXSIZE: 100M + CMAKE_C_COMPILER_LAUNCHER: ccache + CMAKE_CXX_COMPILER_LAUNCHER: ccache steps: - name: Checkout repository @@ -95,8 +97,6 @@ jobs: -GNinja \ -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/libs/install \ -DTPL_ENABLE_MPI:BOOL=ON \ - -DCMAKE_C_COMPILER_LAUNCHER=ccache \ - -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ -DCMAKE_C_FLAGS="-O3 -fPIC" \ -DCMAKE_CXX_FLAGS="-O3 -fPIC" \ -DTrilinos_ENABLE_ALL_PACKAGES:BOOL=OFF \ @@ -113,8 +113,6 @@ jobs: cmake -S . -B build \ -GNinja \ -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/build/install \ - -DCMAKE_C_COMPILER_LAUNCHER=ccache \ - -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ -DCMAKE_C_COMPILER=mpicc \ -DCMAKE_CXX_COMPILER=mpicxx \ -DSCOREC_CXX_OPTIMIZE=ON \ From 41c88bced28fc3806ed06ef7137c04bf8e575bc4 Mon Sep 17 00:00:00 2001 From: Aiden Woodruff Date: Tue, 24 Jun 2025 09:57:13 -0400 Subject: [PATCH 23/24] ci: prune matrix and use cmake env ccache - .github/workflows/cmake.yml: exclude release llvm and c++20. we really only care about the extra warnings from llvm and release should have less code. - set CMAKE_C_COMPILER_LAUNCHER=ccache in top-level workflow env instead of on each config. Signed-off-by: Aiden Woodruff --- .github/workflows/cmake.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index afb2afa9c..5129fd87d 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -29,11 +29,18 @@ jobs: no_mpi: [OFF, ON] cxx_standard: [11, 20] metis: [OFF, ON] + exclude: + - compiler: { name: LLVM } + build_type: Release + - cxx_standard: 20 + build_type: Release env: CCACHE_DIR: ${{github.workspace}}/.ccache CCACHE_BASEDIR: ${{github.workspace}} CCACHE_COMPRESS: true CCACHE_MAXSIZE: 100M + CMAKE_C_COMPILER_LAUNCHER: ccache + CMAKE_CXX_COMPILER_LAUNCHER: ccache steps: - uses: actions/checkout@v4 @@ -82,8 +89,6 @@ jobs: -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/build/install -GNinja -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_BUILD_TYPE=${{matrix.build_type}} - -DCMAKE_C_COMPILER_LAUNCHER=ccache - -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER=mpicxx -DCMAKE_C_COMPILER=mpicc -DCMAKE_CXX_STANDARD=${{matrix.cxx_standard}} -DSCOREC_CXX_WARNINGS=ON @@ -114,7 +119,6 @@ jobs: run: > cmake -S ${{github.workspace}}/doc -B ${{github.workspace}}/buildExample - -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER=mpicc -DCMAKE_CXX_COMPILER=mpicxx -DSCOREC_PREFIX=${{github.workspace}}/build/install ; cmake --build ${{github.workspace}}/buildExample @@ -131,7 +135,6 @@ jobs: cmake -S ${{github.workspace}}/example/mpi-nompi -B ${{github.workspace}}/example/mpi-nompi/build - -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER=mpicxx -DCMAKE_CXX_COMPILER=mpicxx -DSCOREC_PREFIX=${{github.workspace}}/build/install ; cmake --build ${{github.workspace}}/example/mpi-nompi/build ; From 03ef7cfe787c00eb99093c8ce1214ddb61d2df9f Mon Sep 17 00:00:00 2001 From: Aiden Woodruff Date: Tue, 24 Jun 2025 12:04:26 -0400 Subject: [PATCH 24/24] ci: install ccache gcc masq in /opt/ccache - .github/workflows/python-api-test.yml: avoid sudo when installing ccache compiler masquerades by installing into /opt instead of /usr/local/opt. Signed-off-by: Aiden Woodruff --- .github/workflows/python-api-test.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/python-api-test.yml b/.github/workflows/python-api-test.yml index 832d51305..423f3f458 100644 --- a/.github/workflows/python-api-test.yml +++ b/.github/workflows/python-api-test.yml @@ -40,11 +40,11 @@ jobs: run: | sudo apt-get update sudo apt-get install -y mpich libbz2-dev ccache - sudo mkdir -p /usr/local/opt/ccache/libexec - sudo ln -s $(which ccache) /usr/local/opt/ccache/libexec/gcc - sudo ln -s $(which ccache) /usr/local/opt/ccache/libexec/g++ - sudo ln -s $(which ccache) /usr/local/opt/ccache/libexec/cc - sudo ln -s $(which ccache) /usr/local/opt/ccache/libexec/c++ + mkdir -p /opt/ccache/libexec + ln -s $(which ccache) /opt/ccache/libexec/gcc + ln -s $(which ccache) /opt/ccache/libexec/g++ + ln -s $(which ccache) /opt/ccache/libexec/cc + ln -s $(which ccache) /opt/ccache/libexec/c++ pip3 install mpi4py - name: ccache @@ -63,7 +63,7 @@ jobs: run: | git clone https://github.com/swig/swig.git cd swig - export PATH=/usr/local/opt/ccache/libexec:$PATH + export PATH=/opt/ccache/libexec:$PATH ./autogen.sh ./configure --prefix=${{ github.workspace }}/libs/install make