Skip to content

Commit f32aed6

Browse files
committed
Fix ccache basedir/sloppiness.
Signed-off-by: Thomas Alexander <talexander@nvidia.com>
1 parent c197cc5 commit f32aed6

File tree

4 files changed

+18
-10
lines changed

4 files changed

+18
-10
lines changed

.github/actions/ccache-setup/action.yml

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,15 @@ runs:
4040
fi
4141
ccache --set-config=max_size=${{ inputs.max-size }}
4242
ccache --set-config=compression=${{ inputs.compression }}
43-
ccache --set-config=cache_dir="$HOME/.ccache"
44-
# Normalize absolute paths under the workspace so __FILE__ macros
45-
# and hash_dir produce consistent hashes across CI runs.
46-
ccache --set-config=base_dir="${GITHUB_WORKSPACE:-$(pwd)}"
47-
echo "CCACHE_LOGFILE=${GITHUB_WORKSPACE:-$(pwd)}/ccache.log" >> $GITHUB_ENV
48-
# CI checkouts create files with fresh timestamps every run.
49-
# Without these, ccache hashes include mtime/ctime causing misses
50-
# on identical content.
51-
ccache --set-config=sloppiness=include_file_mtime,include_file_ctime,time_macros,pch_defines
52-
echo "CCACHE_DIR=$HOME/.ccache" >> $GITHUB_ENV
43+
# Use environment variables for settings that must be visible to all
44+
# ccache invocations (env vars override config file and avoid issues
45+
# with config file location resolution).
46+
{
47+
echo "CCACHE_DIR=$HOME/.ccache"
48+
echo "CCACHE_BASEDIR=${GITHUB_WORKSPACE:-$(pwd)}"
49+
echo "CCACHE_SLOPPINESS=include_file_mtime,include_file_ctime,time_macros,pch_defines"
50+
echo "CCACHE_LOGFILE=${GITHUB_WORKSPACE:-$(pwd)}/ccache.log"
51+
} >> $GITHUB_ENV
52+
# Export for the ccache -z call below (GITHUB_ENV only applies to subsequent steps)
53+
export CCACHE_DIR="$HOME/.ccache"
5354
ccache -z

docker/build/assets.Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ RUN cd /cuda-quantum && git init && \
7171
$(cat /.git_modules/$local_path/HEAD) $local_path; \
7272
fi; \
7373
done && git submodule init && git submodule
74+
ENV CCACHE_DIR=/root/.ccache
75+
ENV CCACHE_BASEDIR=/cuda-quantum
76+
ENV CCACHE_SLOPPINESS=include_file_mtime,include_file_ctime,time_macros,pch_defines
7477
RUN --mount=from=ccache-data,target=/tmp/ccache-import,rw \
7578
if [ -d /tmp/ccache-import ] && [ "$(ls -A /tmp/ccache-import 2>/dev/null)" ]; then \
7679
echo "Importing ccache data..." && \

docker/build/cudaq.dev.Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ RUN if [ -n "$mpi" ]; \
5353
ARG install=
5454
ARG git_source_sha=xxxxxxxx
5555
ENV CCACHE_DIR=/root/.ccache
56+
ENV CCACHE_BASEDIR="$CUDAQ_REPO_ROOT"
57+
ENV CCACHE_SLOPPINESS=include_file_mtime,include_file_ctime,time_macros,pch_defines
5658
RUN --mount=from=ccache-data,target=/tmp/ccache-import,rw \
5759
if [ -d /tmp/ccache-import ] && [ "$(ls -A /tmp/ccache-import 2>/dev/null)" ]; then \
5860
echo "Importing ccache data..." && \

docker/release/cudaq.wheel.Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ ADD "$workspace" "$destination"
3434

3535
ARG python_version=3.10
3636
ENV CCACHE_DIR=/root/.ccache
37+
ENV CCACHE_BASEDIR=/cuda-quantum
38+
ENV CCACHE_SLOPPINESS=include_file_mtime,include_file_ctime,time_macros,pch_defines
3739
RUN --mount=from=ccache-data,target=/tmp/ccache-import,rw \
3840
if [ -d /tmp/ccache-import ] && [ "$(ls -A /tmp/ccache-import 2>/dev/null)" ]; then \
3941
echo "Importing ccache data..." && \

0 commit comments

Comments
 (0)