tl;dr your compilations are now magically (sometimes) much faster. If you have trouble try
ccache is a compiler cache. That is, it tells when the same thing is being built for a second time, and returns the result of the first compilation instead, immediately. Since often we only make a small change, and many users are working on the same code, this should give good savings for us.
If you're working on one of the novagpvms it should be setup for you automatically. This page documents how it's setup on NOvA in case it needs maintenance in future, and to help off-site locations gain the same benefits.
The ccache manual is pretty good and worth reading https://ccache.samba.org/manual.html
ccache is installed in the $EXTERNALS area as a ups product. That product is created by SRT_NOVA/scripts/make_ccache_product.sh
When you run setupnova the ccache product is set up, and then the script sets a range of environment variables beginning with $CCACHE_ to configure it.
Most are pretty self-explanatory, here are the more interesting ones:
without this, ccache will only cache re-compilation of files in the same specific location. Good to make
make clean && make fast on your test release, bad for sharing with others. Describing how this works is one area the manual falls down. Here's what I've figured out: any reference to a source file under this directory is rewritten to a relative link before compilation, this allows the cache to operate regardless of your absolute directory. The reason not to just set this to
/ is that then paths to things outside of your test release are also rewritten. This works, but it means two test releases in different locations relative to
/ no longer share a cache.
apparently debug builds bake in some information about the filename and compilation time, which defeats the caching. With these options it's possible that in a debug session you could see other users' directory names and out-of-date compilation times. This definitely seems like a price worth paying. If you're ultra-suspicious
export CCACHE_DISABLE and re-compile.
Finally, the magic happens
this ensures that whenever a build tries to invoke
g++ it actually invokes
ccache instead, which then checks its cache, and in case of failure forwards to the real
Offsite maintainers wishing to take advantage need to set up their own cache directory in a convenient place and edit
setup_nova.sh to set the appropriate variables.
You can see some interesting stats with