Skip to content

Commit

Permalink
run nsys in another process
Browse files Browse the repository at this point in the history
  • Loading branch information
FindHao committed Nov 25, 2024
1 parent 45e030a commit ab36ba4
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions tritonbench/components/ncu/nsys_analyzer.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import csv
import os
import shutil
import subprocess
import sys
from typing import Dict, List

Expand Down Expand Up @@ -35,10 +36,14 @@ def read_nsys_report(
reports_required.extend(nsys_metrics_to_reports[metric])
reports_required = list(set(reports_required))
assert reports_required, "No nsys reports required"
cmd = f"nsys stats --report {','.join(reports_required)} --force-export=true --format csv --output . --force-overwrite=true {report_path} > /dev/null 2>&1"
ret = os.system(cmd)
if ret != 0:
raise RuntimeError(f"Failed to export nsys report. Command: {cmd}")
cmd = f"nsys stats --report {','.join(reports_required)} --force-export=true --format csv --output . --force-overwrite=true {report_path}"
try:
subprocess.check_call(
cmd.split(), stdout=subprocess.DEVNULL, stderr=subprocess.PIPE
)
except subprocess.CalledProcessError as e:
print(f"Failed to run nsys command: {cmd}\nError: {e}")
raise
# Get the base path and filename without extension
base_path = os.path.dirname(report_path)
base_name = os.path.splitext(os.path.basename(report_path))[0]
Expand Down

0 comments on commit ab36ba4

Please sign in to comment.