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

Don't write atime file if JAX_COMPILATION_CACHE_MAX_SIZE == -1 #26529

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

skye
Copy link
Member

@skye skye commented Feb 14, 2025

The atime file is only needed to implement the LRU eviction policy, which is only needed if a max persistence compilation cache size is set. Writing this file can cause network filesystem performace and other issues, so only write it if users are opted-in.

The atime file is only needed to implement the LRU eviction policy,
which is only needed if a max persistence compilation cache size is
set. Writing this file can cause network filesystem performace and
other issues, so only write it if users are opted-in.
@skye skye requested a review from jakevdp February 14, 2025 01:39
@skye skye changed the title Don't write atime file if JAX_COMPILATIION_CACHE_MAX_SIZE == -1 Don't write atime file if JAX_COMPILATION_CACHE_MAX_SIZE == -1 Feb 14, 2025
@@ -94,7 +94,6 @@ def get(self, key: str) -> bytes | None:
raise ValueError("key cannot be empty")

cache_path = self.path / f"{key}{_CACHE_SUFFIX}"
atime_path = self.path / f"{key}{_ATIME_SUFFIX}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should keep the atime_path definition here because it's clearer and it will not actually write the file.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I disagree! I think variables only used in a conditional scope should be defined in the conditional scope. See the one true style guide: https://google.github.io/styleguide/cppguide.html#Local_Variables ("Place a function's variables in the narrowest scope possible")

tests/lru_cache_test.py Outdated Show resolved Hide resolved
tests/lru_cache_test.py Outdated Show resolved Hide resolved
tests/lru_cache_test.py Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants