Skip to content
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

ccache for Python packages built in temporary directories (help wanted) #35874

Open
mkoeppe opened this issue Jul 1, 2023 · 2 comments
Open

Comments

@mkoeppe
Copy link
Member

mkoeppe commented Jul 1, 2023

Modern python packaging tools such as build build wheels in temporary directories.
This makes ccache ineffective for repeated builds.
A change like the one below helps partially, but only a small subset of the Cython modules give cache hits.

diff --git a/pkgs/sagemath-categories/setup.py b/pkgs/sagemath-categories/setup.py
index b2fbc8a6ac..d2f445e33c 100644
--- a/pkgs/sagemath-categories/setup.py
+++ b/pkgs/sagemath-categories/setup.py
@@ -20,6 +20,9 @@ sys.excepthook = excepthook
 from sage_setup.setenv import setenv
 setenv()
 
+os.environ['CCACHE_BASEDIR'] = sys.prefix
+os.environ['CCACHE_NOHASHDIR'] = '1'
+
 import sage.env
 sage.env.default_required_modules = sage.env.default_optional_modules = ()
 print(f'##################### {sage.env.SAGE_SRC=}')
@tornaria
Copy link
Contributor

FWIW, I did SAGE_DEBUG=no SAGE_NUM_THREADS=8 PYTHONDONTWRITEBYTECODE=yes python -m build --no-isolation --wheel and I got 1 cache miss, 549 direct hits, 76 preprocessed hits.

For contrast, using SAGE_DEBUG=no SAGE_NUM_THREADS=8 PYTHONDONTWRITEBYTECODE=yes python setup.py build gives me 563 direct hits and 63 preprocessed hits (no misses).

(this is for sagemath-standard)

Maybe SAGE_DEBUG=no makes the difference ?

@mkoeppe
Copy link
Member Author

mkoeppe commented Dec 15, 2023

--no-isolation for sure makes a difference...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants