reprospect.tools.nsys module
- class reprospect.tools.nsys.Cacher(*, directory: str | Path | None = None)View on GitHub
Bases:
CacherCacher tailored to
nsysresults.nsysruns require quite some time to acquire results.On a cache hit, the cacher will serve:
.nsys-repfile.sqlitefile
On a cache miss,
nsysis launched and the cache entry populated accordingly.Note
It is assumed that hashing is faster than running
nsysitself.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.
- __init__(*, directory: str | Path | None = None)View on GitHub
- static export_to_sqlite(command: Command, entry: Entry, **kwargs) PathView on GitHub
Export report to
.sqlite.
- hash(**kwargs) blake3View on GitHub
- hash_impl(*, command: Command) blake3View on GitHub
Hash based on:
nsysversionnsysoptions (but not the output files)executable content
executable arguments
linked libraries
environment
- populate(directory: Path, **kwargs) NoneView on GitHub
When there is a cache miss, call
reprospect.tools.nsys.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.
- class reprospect.tools.nsys.Command(*, executable: str | Path, output: Path, opts: tuple[str, ...] = (), nvtx_capture: str | None = None, capture_range_end: str = 'stop', args: tuple[str | Path, ...] | None = None, env: Mapping[str, str] | None = None)View on GitHub
Bases:
objectRun a
nsyscommand line.- __init__(*, executable: str | Path, output: Path, opts: tuple[str, ...] = (), nvtx_capture: str | None = None, capture_range_end: str = 'stop', args: tuple[str | Path, ...] | None = None, env: Mapping[str, str] | None = None) None
Method generated by attrs for class Command.
- run(*, cwd: Path | None = None, env: MutableMapping[str, str] | None = None) intView on GitHub
- class reprospect.tools.nsys.Report(*, db: Path)View on GitHub
Bases:
objectHelper for reading the SQLite export of a
nsysreport.- __enter__() SelfView on GitHub
- __exit__(*args, **kwargs) NoneView on GitHub
- __init__(*, db: Path) NoneView on GitHub
Select a row from src, and return the row from dst that matches by correlation ID.
Similar to
get_correlated_row(), but may match more than one row.
- get_events(table: str, accessors: Sequence[str], stringids: str | None = 'nameId') DataFrameView on GitHub
Query all rows in table that happen between the start/end time points of the nested NVTX range matching accessors.
- Parameters:
stringids – Some tables have a column to be correlated with the StringIds table.
Note
This replaces nsys stats whose –filter-nvtx is not powerful enough, as of CUDA 13.0.0.
- property nvtx_events: ReportNvtxEventsView on GitHub
Get all NVTX events from the NVTX_EVENTS table.
Add a children column that contains for each event a list of child indices, preserving the hierarchy of the nested NVTX ranges.
Add a level column, starting from 0 for the root events.
Note
Nesting is determined based on start and end time points.
Note
Events recorded with registered strings will have there text field set to NULL, and its textId field set.
We correlate the textId with the StringIds if need be.
- static single_row(*, data: DataFrame) SeriesView on GitHub
Check that data has one row, and squeeze it.
- table(*, name: str, **kwargs) DataFrameView on GitHub
Get a table from the report.
- property tables: list[str]View on GitHub
Tables in the report.
- class reprospect.tools.nsys.ReportNvtxEvents(events: DataFrame)View on GitHub
Bases:
TreeMixin- __init__(events: DataFrame) NoneView on GitHub
- get(accessors: Sequence[str]) DataFrameView on GitHub
Find all nested NVTX events matching accessors.
- to_tree() TreeView on GitHub
- class reprospect.tools.nsys.ReportPatternSelector(pattern: str | Pattern[str], column: str = 'Name')View on GitHub
Bases:
objectA
pandas.DataFrameselector that returns which rows match a regex pattern in a specific column.
- class reprospect.tools.nsys.Session(command: Command)View on GitHub
Bases:
objectNsight Systems session interface.
- export_to_sqlite(cwd: Path | None = None) PathView on GitHub
Export report to
.sqlite.
- extract_statistical_report(report: str = 'cuda_api_sum', filter_nvtx: str | None = None, cwd: Path | None = None) DataFrameView on GitHub
Extract report, filtering the database with filter_nvtx.
- run(cwd: Path | None = None, env: MutableMapping[str, str] | None = None) NoneView on GitHub
Run
nsysusingcommand.
- reprospect.tools.nsys.strip_cuda_api_suffix(call: str) strView on GitHub
Strip suffix like _v10000 or _ptsz from a CUDA API call.