GH-51138: [Python] Fix ccache efficiency - #51139
Conversation
|
|
9a5a1b7 to
a66cc75
Compare
|
@github-actions crossbow submit -g python |
|
Revision: a66cc75 Submitted crossbow builds: ursacomputing/crossbow @ actions-290df36268 |
|
@github-actions crossbow submit test-ubuntu-22.04-cpp -p image=ubuntu-python |
|
Revision: a66cc75 Submitted crossbow builds: ursacomputing/crossbow @ actions-ba899c1522
|
What's this @rok ? |
| # 2. Set ccache base_dir to the build output directory as it is typically | ||
| # a temporary directory, and would otherwise fail caching because of | ||
| # using different paths everytime. | ||
| set(ccache_command ${CCACHE_FOUND} keep_comments_cpp=true base_dir=${CMAKE_BINARY_DIR}) |
There was a problem hiding this comment.
As per my 🤖 ccache pre-4.8 does not accept compiler options (keep_comments_cpp=true in this case). And testing on an older ccache I get:
> ccache keep_comments_cpp=true base_dir=/tmp gcc --version
ccache: error: Could not find compiler "keep_comments_cpp=true" in PATHSo users with old ccache building pyarrow would have this crash.
There was a problem hiding this comment.
Hmm, are there any Python builds which use an old ccache?
There was a problem hiding this comment.
I think no, but users might. I think this is obscure enough to ignore.
There was a problem hiding this comment.
If there was an easy way to query the ccache version we could work around this to ensure a better UX. But I'm not sure how to do that. @kou ?
There was a problem hiding this comment.
(for the record, ccache 4.8 was released in March 2023)
There was a problem hiding this comment.
It can avoid the error but meaningless ccache command is still used (ccache storage is consumed). If it's acceptable, we can use the cmake -E env approach.
There was a problem hiding this comment.
Because:
Cython-generated C++ sources are written in the temporary build directory (because of build isolation), and therefore their path changes everytime. Consequently, ccache would fail reusing previous compilation results.
There was a problem hiding this comment.
We're setting CCACHE_BASEDIR precisely to avoid that.
|
@github-actions crossbow submit wheelcp311* |
|
Revision: a66cc75 Submitted crossbow builds: ursacomputing/crossbow @ actions-131e0bf55a |
a66cc75 to
a1df242
Compare
|
@github-actions crossbow submit -g python |
|
@github-actions crossbow submit wheelcp311* |
|
Revision: a1df242 Submitted crossbow builds: ursacomputing/crossbow @ actions-db9b456f6a |
|
Revision: a1df242 Submitted crossbow builds: ursacomputing/crossbow @ actions-695eab7643 |
|
I'm going to merge as CI failures are unrelated. |
Rationale for this change
Our current ccache support for PyArrow currently has two issues:
What changes are included in this PR?
base_dirto the temporary build directory so that ccache strips away the build directory and hits previously cached results obtained from a different build directory.Are these changes tested?
Yes, locally I confirmed that ccache now efficiently reuses compilation outputs for Cython-generated C++ sources.
Before:
After:
Are there any user-facing changes?
No.