inducer / pyopencl

OpenCL integration for Python, plus shiny features
http://mathema.tician.de/software/pyopencl
Other
1.04k stars 238 forks source link

Compiler cache: honor XDG_CACHE_HOME on MacOS #716

Closed matthiasdiener closed 3 months ago

matthiasdiener commented 3 months ago

Similar to https://github.com/inducer/pytools/pull/204

alexfikl commented 3 months ago

I understand the need here, but I'm a curious about some things:

matthiasdiener commented 3 months ago
  • Why only on macOS and not Windows? Can the Windows paths be overwritten by environment variables?

Looking at https://github.com/platformdirs/platformdirs/blob/main/src/platformdirs/windows.py#L251, I guess so, but my knowledge of Windows is almost zero 😞

  • If we're forcing a non-native environment variable on other OSes, why not use something like PYOPENCL_CACHE_DIR (to mirror PYOPENCL_NO_CACHE)?

We could add PYOPENCL_CACHE_DIR, but the current goal was to make the disk caching selection consistent across loopy and pyopencl, for both Mac and Linux.

Edit: another important reason: Pocl also honors XDG_CACHE_HOME on MacOS.

alexfikl commented 3 months ago

Edit: another important reason: Pocl also honors XDG_CACHE_HOME on MacOS.

Fair enough, but they just fallback to it and also have a POCL_CACHE_DIR (at least that's what the docs say).

matthiasdiener commented 3 months ago

This is ready for review @inducer.

inducer commented 3 months ago

LGTM, thanks!