conclude_performance() crashes when test_iterations is 1 or 2

Offen Anfängerfreundlich
#44 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
1/5
Geschätzter Aufwand
Unter einer Stunde
Anfängerfreundlichkeit
78/100
Issue-Typ
Bug
Klarheit
Klar beschrieben
Aktivitätsstatus
Aktiv
Tech-Stack
python

Rechercherichtung

Beginne am Trimming-Block um Zeile 201 von ros2_benchmark/ros2_benchmark/basic_performance_calculator.py in conclude_performance() und übernimm die bereits in utils/nvidia_smi_profiler.py verwendete Schutzbedingung len(metric_value_list) > 2. Reproduziere mit einem gestubbten rclpy und ein oder zwei synthetischen Iterationen durch calculate_performance() und dann conclude_performance(). Beachte, dass test/benchmark_pol.py den TIMELINE-Modus verwendet und deshalb diesen Pfad nie ausführt. Fertig ist, wenn 1, 2 und 3 Iterationen Metriken melden, statt eine Exception auszulösen. Der Melder hat angeboten, einen PR zu eröffnen; prüfe vor dem Start, ob bereits einer existiert.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

BasicPerformanceCalculator.conclude_performance() always drops the highest and the lowest value of each metric before averaging (ros2_benchmark/ros2_benchmark/basic_performance_calculator.py, around line 201):

# Remove the best and the worst before concluding the metric
metric_value_list.remove(max(metric_value_list))
metric_value_list.remove(min(metric_value_list))

With test_iterations: 1 or 2 there is nothing left after that, so the run fails at the very end, after all iterations have finished, and no results file is written:

  • test_iterations: 1 -> ValueError: min() arg is an empty sequence
  • test_iterations: 2 -> ZeroDivisionError: division by zero (for the mean metrics)
  • test_iterations: 3 and up work

This is hit in LOOPING (the default), SWEEPING and LIVE modes, which call conclude_performance() after the iteration loop in ros2_benchmark_test.py. TIMELINE mode does not call it, which is probably why test/benchmark_pol.py (TIMELINE, test_iterations=1) does not show it.

The resource side already handles this: utils/nvidia_smi_profiler.py only trims when len(metric_value_list) > 2.

To reproduce without ROS, load the module with a stub rclpy, feed one or two iterations of synthetic timestamps to calculate_performance(), then call conclude_performance():

1 FAIL ValueError min() arg is an empty sequence
2 FAIL ZeroDivisionError division by zero
3 ok 111.11

Expected: with one or two iterations, report the metrics over those iterations, same as the resource profiler does. Using the same > 2 guard here would fix it. I can open a small PR for that.

Vorherrschende Sprache
Python
Sterne
145
Forks
18
Ø Merge
1 Min.
Gemergte PRs (30 T.)
1

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus NVIDIA-ISAAC-ROS/ros2_benchmark

Alle Issues in NVIDIA-ISAAC-ROS/ros2_benchmark

Ähnliche Issues

Weitere Issues zu Python

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.