Replacing subprocess with shutil

Signed-off-by: coleramos425 <colramos@amd.com>
这个提交包含在:
coleramos425
2023-08-24 15:54:00 -05:00
父节点 b65aacff0e
当前提交 7d457b5096
修改 3 个文件,包含 12 行新增18 行删除
+4 -5
查看文件
@@ -44,10 +44,9 @@ def resolve_rocprof(returnPath=False):
else:
rocprof_cmd = os.environ["ROCPROF"]
rocprof_path = subprocess.run(
["which", rocprof_cmd], stdout=subprocess.PIPE, stderr=subprocess.DEVNULL
)
if rocprof_path.returncode != 0:
rocprof_path = shutil.which(rocprof_cmd)
if not rocprof_path:
print("\nError: Unable to resolve path to %s binary" % rocprof_cmd)
print(
"Please verify installation or set ROCPROF environment variable with full path."
@@ -55,7 +54,7 @@ def resolve_rocprof(returnPath=False):
sys.exit(1)
else:
# Resolve any sym links in file path
rocprof_path = os.path.realpath(rocprof_path.stdout.decode("utf-8").rstrip("\n"))
rocprof_path = os.path.realpath(rocprof_path.rstrip("\n"))
print("ROC Profiler: ", rocprof_path)
if returnPath:
return rocprof_path
+7 -12
查看文件
@@ -35,6 +35,7 @@ import pandas as pd
from datetime import datetime
from pathlib import Path as path
import warnings
import shutil
from parser import parse
from utils import specs
@@ -438,10 +439,8 @@ def characterize_app(args, VER):
def run_rocscope(args, fname):
# profile the app
if args.use_rocscope == True:
result = subprocess.run(
["which", "rocscope"], stdout=subprocess.PIPE, stderr=subprocess.DEVNULL
)
if result.returncode == 0:
result = shutil.which("rocscope")
if result:
rs_cmd = [
result.stdout.decode("ascii").strip(),
"metrics",
@@ -553,10 +552,8 @@ def omniperf_profile(args, VER):
print(e)
sys.exit(1)
result = subprocess.run(
["which", "rocscope"], stdout=subprocess.PIPE, stderr=subprocess.DEVNULL
)
if result.returncode == 0:
result = shutil.which("rocscope")
if result:
rs_cmd = [
result.stdout.decode("ascii").strip(),
"top10",
@@ -587,10 +584,8 @@ def omniperf_profile(args, VER):
print(e)
sys.exit(1)
result = subprocess.run(
["which", "rocscope"], stdout=subprocess.PIPE, stderr=subprocess.DEVNULL
)
if result.returncode == 0:
result = shutil.which("rocscope")
if result:
rs_cmd = [
result.stdout.decode("ascii").strip(),
"summary",
+1 -1
查看文件
@@ -22,7 +22,7 @@
# SOFTWARE.
##############################################################################el
import sys, os, pathlib, shutil, subprocess, argparse, glob, re
import sys, os, shutil, glob, re
import numpy as np
import math
import warnings