-
Notifications
You must be signed in to change notification settings - Fork 65
add ccache to Github CI #500
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- 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 <[email protected]>
- 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 <[email protected]>
Signed-off-by: Aiden Woodruff <[email protected]>
- 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 <[email protected]>
- use apt-get (which has a more stable CLI interface) instead of apt. Signed-off-by: Aiden Woodruff <[email protected]>
- 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 <[email protected]>
Signed-off-by: Aiden Woodruff <[email protected]>
- 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 <[email protected]>
- 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 <[email protected]>
This except from a failing run shows that ctest
|
- not only is nprocs missing, but the DEPENDS property isn't good enough. Signed-off-by: Aiden Woodruff <[email protected]>
- .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 <[email protected]>
- .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 <[email protected]>
Also, I'm investigating the low cache hit ratio. Right now most jobs get ~50% for the exact same code. |
- 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 <[email protected]>
- with is only for reusable workflows. Signed-off-by: Aiden Woodruff <[email protected]>
- 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 <[email protected]>
Signed-off-by: Aiden Woodruff <[email protected]>
I figured out that this was due to zeroing statistics before restoring the cache. Now cache hits are >95%. |
- .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 <[email protected]>
- also do shallow clone Signed-off-by: Aiden Woodruff <[email protected]>
- 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 <[email protected]>
- 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 <[email protected]>
- 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 <[email protected]>
- 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 <[email protected]>
- .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 <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Thank you.
- .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 <[email protected]>
add ccache to Github CI
--config
) because ninja is single-config.-j
fromcmake --build
because ninja is parallel by default.Unfortunately, caches (with GitHub
actions/cache
) are scoped by branch. So the first commit may still run a long time, but subsequent commits will be much faster.Reduced time on from ~2h to ~50m (total runtime for all jobs in matrix).