profiler_command#
Profiler command wrappers for different profilers (Unitrace, NCU, VTune)
Functions
|
Get the appropriate profiler class based on user-specified profiler type or language & GPU architecture. |
Classes
|
Nsight Compute profiler helper |
|
Helper to run Unitrace for OpenCL kernels with metric-sampling |
|
Abstract base class for profiler helpers |
|
Unitrace profiler helper |
|
VTune profiler helper for Intel GPUs |
Exceptions
Exception if profiler cannot be found |
Exception if profiler cannot be found
- class kernelfoundry.eval_pipeline.profiler_command.Profiler(output_dir: Path | str)[source]#
Abstract base class for profiler helpers
Why this profiler cannot run on this machine, or
Noneif nothing rules it out.
- abstract wrap_cmd(cmd: str) str[source]#
Wrap the given command with profiler-specific command :param cmd: The original command to run the program without profiling
- Returns:
A wrapped command that includes the original command and any additional commands needed for profiling.
- env_vars()[source]#
Return a dictionary of environment variables to update or add when running the command
- end_marker() str | None[source]#
Return the end-of-process marker string for this profiler.
The marker is passed to
robust_subprocess_runto detect when the profiled process has finished and can safely be terminated.The default
"pytest"activates the pytest-summary monitor, which waits for the pytest result line. Return a different string to watch for that literal in the output, orNoneto disable early termination entirely.
- class kernelfoundry.eval_pipeline.profiler_command.Unitrace(output_dir: Path | str, group: str = 'ComputeBasic', timeline: bool = True, unitrace_cmd: str = 'unitrace')[source]#
Unitrace profiler helper
- __init__(output_dir: Path | str, group: str = 'ComputeBasic', timeline: bool = True, unitrace_cmd: str = 'unitrace')[source]#
- class kernelfoundry.eval_pipeline.profiler_command.OCLUnitrace(output_dir: Path | str, group: str = 'ComputeBasic', timeline: bool = True, unitrace_cmd: str = 'unitrace')[source]#
Helper to run Unitrace for OpenCL kernels with metric-sampling
- end_marker() str | None[source]#
Return the end-of-process marker string for this profiler.
The marker is passed to
robust_subprocess_runto detect when the profiled process has finished and can safely be terminated.The default
"pytest"activates the pytest-summary monitor, which waits for the pytest result line. Return a different string to watch for that literal in the output, orNoneto disable early termination entirely.
- class kernelfoundry.eval_pipeline.profiler_command.NCU(output_dir: Path | str, ncu_cmd: str = 'ncu')[source]#
Nsight Compute profiler helper
Why this profiler cannot run on this machine, or
Noneif nothing rules it out.
- wrap_cmd(cmd: str) str[source]#
Wrap the given command with NCU profiling command.
ncuneeds elevated privileges to read performance counters unless the driver has been told to allow it for all users. Since sudo is disabled on Windows, the command is issued plainly: it succeeds where counter access has been granted, and where it has not, read_output explains what to do.See https://developer.nvidia.com/nvidia-development-tools-solutions-err_nvgpuctrperm-permission-issue-performance-counters for how to enable non-root profiling on either platform.
- class kernelfoundry.eval_pipeline.profiler_command.VTune(output_dir: Path | str, vtune_cmd: str = 'vtune')[source]#
VTune profiler helper for Intel GPUs
- wrap_cmd(cmd: str) str[source]#
Wrap the given command with VTune collection and hotspot report generation.
Chains two commands with && so all vtune invocations happen inside the same environment (e.g. container) where vtune is available:
vtune -collect (paused; the kernel under test resumes it via ITT)
vtune -report hotspots -> tsv file
read_output() then simply reads that file without invoking vtune.
- end_marker() str | None[source]#
Return the end-of-process marker string for this profiler.
The marker is passed to
robust_subprocess_runto detect when the profiled process has finished and can safely be terminated.The default
"pytest"activates the pytest-summary monitor, which waits for the pytest result line. Return a different string to watch for that literal in the output, orNoneto disable early termination entirely.