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

Cache files library and CLI tool #266

Open
wants to merge 261 commits into
base: master
Choose a base branch
from
Open

Cache files library and CLI tool #266

wants to merge 261 commits into from

Conversation

benvanwerkhoven
Copy link
Collaborator

This pull request restores the accidentally closed pull request #265 that I can't seem to otherwise restore myself. This time its not from a 'master' branch on a fork, but from a branch of our own repository which makes it easier to work with.

To restore the original text of the pull request by @tdejong00:

This pull request adds an interface for modifying cache files, which is located in the kernel_tuner/cache directory. This directory contains the following modules:

  • cache (main module): contains a Cache class through which cache files can be created, read and written. This should be the only python module that needs to be used for modifying cache files.
  • cli_tools: contains functions used in the ktcache command.
  • convert: contains functions for converting (older) cache files to newer cache files.
  • file: contains functions for reading JSON from and writing JSON to cache files.
  • json: contains TypeDict type hints for typing code.
  • json_encoder: contains a custom instance of JSONEncoder that automatically serializes data into JSON in a readable format.
  • paths: contains useful paths within the project.
  • versions: exports useful Semver version constants.

Furthermore the following test modules have been added:

  • test_cachefile_class.py: tests whether the class integrates the functionalities of the other cache modules in the correct way and the additional logic in the Cache class.
  • test_cachefile_encoder.py: tests whether the JSON is encoded in the right way.
  • test_cachefile_read_write.py: tests whether cache is read and written in the correct format.
  • test_cachefile_schema.py: tests the correctness of the schema.
  • test_script_ktcache.py: tests the ktcache CLI command.

We have not yet added an entry to the CHANGELOG.md, because we are not sure in what version these changes will be introduced.

warnio and others added 30 commits February 26, 2024 20:49
…t instead of a filename, added a unit test for cache conversion (although i dont know how to run it)
Copy link

sonarcloud bot commented Jun 28, 2024

@fjwillemsen
Copy link
Collaborator

I've just tried to convert a Kernel Tuner cache file to the T4 format, but the conversion does not yet handle non-valid configurations. This can be seen in convert.py from line 187, where the assumption is that all cachelines have times.

invalidity = "constraints"

result = T4ResultLineJSON(
timestamp=cache_line["timestamp"],
Copy link
Collaborator

Choose a reason for hiding this comment

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

This line requires the input cachefile to have timestamps, is that something we want to enforce or are we okay with something like cache_line.get("timestamp", None)?

Copy link

sonarcloud bot commented Oct 29, 2024

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.

9 participants