model_analyzer/record/metrics_manager.py
def profile_model(self, run_config, perf_output_writer=None):
        """
        Runs monitors while running perf_analyzer with a specific set of
        arguments. This will profile model inferencing.

        Parameters
        ----------
        run_config : RunConfig
            run_config object corresponding to the model being profiled.
        perf_output_writer : OutputWriter
            Writer that writes the output from perf_analyzer to the output
            stream/file. If None, the output is not written

        Returns
        -------
        (dict of lists, list)
            The gpu specific and non gpu metrics
        """

        cpu_only = run_config.model_config().cpu_only()
        perf_config = run_config.perf_config()

        # Inform user CPU metric(s) are not being collected under CPU mode
        collect_cpu_metrics_expect = cpu_only or len(self._gpus) == 0
        collect_cpu_metrics_actual = len(self._cpu_metrics) > 0
        if collect_cpu_metrics_expect and not collect_cpu_metrics_actual:
            logger.info(
                "CPU metric(s) are not being collected, while this profiling will run on CPU(s)."
            )
        # Warn user about CPU monitor performance issue
        if collect_cpu_metrics_actual:
            logger.warning("CPU metric(s) are being collected.")
            logger.warning(
                "Collecting CPU metric(s) can affect the latency or throughput numbers reported by perf analyzer."
            )

        # Start monitors and run perf_analyzer
        self._start_monitors(cpu_only=cpu_only)
        perf_analyzer_metrics_or_status = self._get_perf_analyzer_metrics(
            perf_config,
            perf_output_writer,
            perf_analyzer_env=run_config.triton_environment())

        # Failed Status
        if perf_analyzer_metrics_or_status == 1:
            self._stop_monitors(cpu_only=cpu_only)
            self._destroy_monitors(cpu_only=cpu_only)
            return None
        else:
            perf_analyzer_metrics = perf_analyzer_metrics_or_status

        # Get metrics for model inference and combine metrics that do not have GPU UUID
        model_gpu_metrics = {}
        if not cpu_only:
            model_gpu_metrics = self._get_gpu_inference_metrics()
        model_cpu_metrics = self._get_cpu_inference_metrics()

        self._destroy_monitors(cpu_only=cpu_only)

        model_non_gpu_metrics = list(perf_analyzer_metrics.values()) + list(
            model_cpu_metrics.values())

        measurement = None
        if model_gpu_metrics is not None and model_non_gpu_metrics is not None:
            measurement = Measurement(gpu_data=model_gpu_metrics,
                                      non_gpu_data=model_non_gpu_metrics,
                                      perf_config=perf_config)
            self._result_manager.add_measurement(run_config, measurement)
        return measurement

        Runs monitors while running perf_analyzer with a specific set of
        arguments. This will profile model inferencing.

        Parameters
        ----------
        run_config : RunConfig
            run_config object corresponding to the model being profiled.
        perf_output_writer : OutputWriter
            Writer that writes the output from perf_analyzer to the output
            stream/file. If None, the output is not written

        Returns
        -------
        (dict of lists, list)
            The gpu specific and non gpu metrics
        
Runs monitors while running perf_analyzer with a specific set of
arguments. This will profile model inferencing.

Parameters

run_config : RunConfig
run_config object corresponding to the model being profiled.
perf_output_writer : OutputWriter
Writer that writes the output from perf_analyzer to the output
stream/file. If None, the output is not written

Returns

(dict of lists, list)
The gpu specific and non gpu metrics
Runs monitors while running perf_analyzer with a specific set of arguments . This will profile model inferencing . Parameters run_config : RunConfig run_config object corresponding to the model being profiled . perf_output_writer : OutputWriter Writer that writes the output from perf_analyzer to the output stream / file . If None the output is not written Returns ( dict of lists list ) The gpu specific and non gpu metrics
def profile_model(self, run_config, perf_output_writer=None):
        cpu_only = run_config.model_config().cpu_only()
        perf_config = run_config.perf_config()
        collect_cpu_metrics_expect = cpu_only or len(self._gpus) == 0
        collect_cpu_metrics_actual = len(self._cpu_metrics) > 0
        if collect_cpu_metrics_expect and not collect_cpu_metrics_actual:
            logger.info(
                "CPU metric(s) are not being collected, while this profiling will run on CPU(s)."
            )
        if collect_cpu_metrics_actual:
            logger.warning("CPU metric(s) are being collected.")
            logger.warning(
                "Collecting CPU metric(s) can affect the latency or throughput numbers reported by perf analyzer."
            )
        self._start_monitors(cpu_only=cpu_only)
        perf_analyzer_metrics_or_status = self._get_perf_analyzer_metrics(
            perf_config,
            perf_output_writer,
            perf_analyzer_env=run_config.triton_environment())
        if perf_analyzer_metrics_or_status == 1:
            self._stop_monitors(cpu_only=cpu_only)
            self._destroy_monitors(cpu_only=cpu_only)
            return None
        else:
            perf_analyzer_metrics = perf_analyzer_metrics_or_status
        model_gpu_metrics = {}
        if not cpu_only:
            model_gpu_metrics = self._get_gpu_inference_metrics()
        model_cpu_metrics = self._get_cpu_inference_metrics()
        self._destroy_monitors(cpu_only=cpu_only)
        model_non_gpu_metrics = list(perf_analyzer_metrics.values()) + list(
            model_cpu_metrics.values())
        measurement = None
        if model_gpu_metrics is not None and model_non_gpu_metrics is not None:
            measurement = Measurement(gpu_data=model_gpu_metrics,
                                      non_gpu_data=model_non_gpu_metrics,
                                      perf_config=perf_config)
            self._result_manager.add_measurement(run_config, measurement)
        return measurement
def profile_model ( self , run_config , perf_output_writer = None ) : cpu_only = run_config . model_config ( ) . cpu_only ( ) perf_config = run_config . perf_config ( ) collect_cpu_metrics_expect = cpu_only or len ( self . _gpus ) == 0 collect_cpu_metrics_actual = len ( self . _cpu_metrics ) > 0 if collect_cpu_metrics_expect and not collect_cpu_metrics_actual : logger . info ( "CPU metric(s) are not being collected, while this profiling will run on CPU(s)." ) if collect_cpu_metrics_actual : logger . warning ( "CPU metric(s) are being collected." ) logger . warning ( "Collecting CPU metric(s) can affect the latency or throughput numbers reported by perf analyzer." ) self . _start_monitors ( cpu_only = cpu_only ) perf_analyzer_metrics_or_status = self . _get_perf_analyzer_metrics ( perf_config , perf_output_writer , perf_analyzer_env = run_config . triton_environment ( ) ) if perf_analyzer_metrics_or_status == 1 : self . _stop_monitors ( cpu_only = cpu_only ) self . _destroy_monitors ( cpu_only = cpu_only ) return None else : perf_analyzer_metrics = perf_analyzer_metrics_or_status model_gpu_metrics = { } if not cpu_only : model_gpu_metrics = self . _get_gpu_inference_metrics ( ) model_cpu_metrics = self . _get_cpu_inference_metrics ( ) self . _destroy_monitors ( cpu_only = cpu_only ) model_non_gpu_metrics = list ( perf_analyzer_metrics . values ( ) ) + list ( model_cpu_metrics . values ( ) ) measurement = None if model_gpu_metrics is not None and model_non_gpu_metrics is not None : measurement = Measurement ( gpu_data = model_gpu_metrics , non_gpu_data = model_non_gpu_metrics , perf_config = perf_config ) self . _result_manager . add_measurement ( run_config , measurement ) return measurement
Runs monitors while running perf_analyzer with a specific set of
arguments.
Runs monitors while running perf_analyzer with a specific set of arguments .
"""
        Runs monitors while running perf_analyzer with a specific set of
        arguments. This will profile model inferencing.

        Parameters
        ----------
        run_config : RunConfig
            run_config object corresponding to the model being profiled.
        perf_output_writer : OutputWriter
            Writer that writes the output from perf_analyzer to the output
            stream/file. If None, the output is not written

        Returns
        -------
        (dict of lists, list)
            The gpu specific and non gpu metrics
        """ # Inform user CPU metric(s) are not being collected under CPU mode # Warn user about CPU monitor performance issue # Start monitors and run perf_analyzer # Failed Status # Get metrics for model inference and combine metrics that do not have GPU UUID
self
run_config
perf_output_writer