reprospect.tools.ncu.cacher module

class reprospect.tools.ncu.cacher.Cacher(*, directory: str | Path | None = None)View on GitHub

Bases: Cacher

Cacher tailored to ncu results.

ncu require quite some time to acquire results, especially when there are many kernels to profile and/or many metrics to collect.

On a cache hit, the cacher will serve:

  • <cache_key>.ncu-rep file

  • .log file

On a cache miss, ncu is launched and the cache entry populated accordingly.

Note

It is assumed that hashing is faster than running ncu itself.

Warning

The cache should not be shared between machines, since there may be differences between machines that influence the results but are not included in the hashing.

TABLE: ClassVar[str] = 'ncu'

Name of the table.

__init__(*, directory: str | Path | None = None)View on GitHub
database: sqlite3.Connection | None
hash(**kwargs) blake3View on GitHub
hash_impl(*, command: Command) blake3View on GitHub

Hash based on:

  • ncu version

  • ncu options (but not the output and log files)

  • executable content

  • executable arguments

  • linked libraries

  • environment

populate(directory: Path, **kwargs) NoneView on GitHub

When there is a cache miss, call reprospect.tools.ncu.Session.run(). Fill the directory with the artifacts.

run(command: Command, **kwargs) EntryView on GitHub

On a cache hit, copy files from the cache entry.