Utils#
- class nsight.utils.Colors#
Bases:
objectFor colorful printing.
- BLUE = '\x1b[0;34m'#
- BOLD = '\x1b[1m'#
- CYAN = '\x1b[0;36m'#
- ENDC = '\x1b[0m'#
- GREEN = '\x1b[0;32m'#
- HEADER = '\x1b[95m'#
- ORANGE = '\x1b[0;33m'#
- PURPLE = '\x1b[0;35m'#
- RED = '\x1b[0;31m'#
- UNDERLINE = '\x1b[4m'#
- class nsight.utils.NCUActionData( )#
Bases:
object
- class nsight.utils.NCULogParser#
Bases:
LogParserParse NCU log file.
- nsight.utils.batched(iterable: Any, n: int)#
Batch an iterable into tuples of size n.
This is a minimal backport of itertools.batched for Python 3.10 and 3.11, where the standard library implementation is not available.
- nsight.utils.format_ncu_error_message(context: NCUErrorContext)#
Format NCU error context into user-friendly error message.
- Parameters:
context (
NCUErrorContext) – The error context containing all relevant information.- Return type:
- nsight.utils.get_dummy_kernel_module()#
Returns a dummy kernel that does nothing. In case a provider fails for some, reason, but we want to keep benchmarking we launch this dummy kernel such that during our later analysis of the ncu-report we still find the expected number of measured kernels per provider.
The measured runtime of this kernel is ignored and the final result of the failed run will be reported as NaN.
- Raises:
ImportError – If cuda-core is not installed.
- Return type:
- nsight.utils.launch_dummy_kernel_module()#
Launch a dummy kernel module.
- Raises:
ImportError – If cuda-core is not installed.
- Return type:
- nsight.utils.print_config( )#
Prints the current configuration being profiled.
- Parameters:
total_configs (
int) – Total number of configurations.curr_config (
int) – Current configuration index.c (
Any) – The current configuration parameters.overwrite_output (
bool) – Controls how configurations are printed: - True: The configuration is updated in-place - False: Each configuration is printed on a new line
- Return type:
- nsight.utils.print_progress_bar( )#
Prints a dynamic progress bar to the terminal.
- Parameters:
total_runs (
int) – Total number of runs to execute.curr_run (
int) – Current run index.bar_length (
int) – Length of the progress bar in characters.avg_time_per_run (
float) – Average time taken per run, used to estimate remaining time.overwrite_output (
bool) – Controls how configurations are printed: - True: Overwrites the existing progress bar - False: Writes a new progress bar
- Return type: