Skip to content

Commit 7513bab

Browse files
Add metadata for profiling (#2369)
Closes #2370 Signed-off-by: Anatoly Myachev <[email protected]> Co-authored-by: Egor Krivov <[email protected]>
1 parent e97e480 commit 7513bab

File tree

2 files changed

+47
-5
lines changed

2 files changed

+47
-5
lines changed

scripts/build_report.py

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@ def parse_args():
1414
"target",
1515
help="Path to result csv file with benchmark results including host info and dates",
1616
)
17-
parser.add_argument("--param_cols", help="Names of parameter columns, separated by commas.", required=True)
17+
parser.add_argument(
18+
"--param_cols",
19+
help="Names of parameter columns, separated by commas.",
20+
required=True,
21+
)
1822
parser.add_argument("--benchmark", help="Name of the benchmark.", required=True)
1923
parser.add_argument("--compiler", help="Name of the compiler, like `triton`.", required=True)
2024
parser.add_argument("--tflops_col", help="Column name with tflops.", required=True)
@@ -47,10 +51,18 @@ def transform_df(df, param_cols, tflops_col, hbm_col, benchmark, compiler, tag):
4751

4852
host_info = {
4953
n: os.getenv(n.upper(), default="")
50-
for n in ["libigc1_version", "level_zero_version", "gpu_device", "agama_version"]
54+
for n in [
55+
"libigc1_version",
56+
"level_zero_version",
57+
"gpu_device",
58+
"agama_version",
59+
"torch_version",
60+
"compiler_version",
61+
"benchmarking_method",
62+
]
5163
}
5264
if not host_info["gpu_device"]:
53-
raise RuntimeError("Could not find GPU device description, was capture_device.sh called?")
65+
raise RuntimeError("Could not find GPU device description, was `capture-hw-details.sh` called?")
5466
for name, val in host_info.items():
5567
df_results[name] = val
5668

@@ -61,8 +73,15 @@ def main():
6173
args = parse_args()
6274
param_cols = args.param_cols.split(",")
6375
df = pd.read_csv(args.source)
64-
result_df = transform_df(df, param_cols=param_cols, tflops_col=args.tflops_col, hbm_col=args.hbm_col,
65-
benchmark=args.benchmark, compiler=args.compiler, tag=args.tag)
76+
result_df = transform_df(
77+
df,
78+
param_cols=param_cols,
79+
tflops_col=args.tflops_col,
80+
hbm_col=args.hbm_col,
81+
benchmark=args.benchmark,
82+
compiler=args.compiler,
83+
tag=args.tag,
84+
)
6685
result_df.to_csv(args.target, index=False)
6786

6887

scripts/capture-hw-details.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,32 @@ else
4646
export GPU_DEVICE="Not Installed"
4747
fi
4848

49+
if python -c "import torch" &> /dev/null; then
50+
export TORCH_VERSION=$(python -c "import torch; from packaging.version import Version; print(Version(torch.__version__).base_version)")
51+
else
52+
export TORCH_VERSION="Not installed"
53+
fi
54+
55+
if icpx --version &> /dev/null; then
56+
export COMPILER_VERSION=$(icpx --version | grep "DPC++/C++ Compiler" | sed 's/.*(\(.*\))/\1/' | cut -d '.' -f 1-3)
57+
else
58+
export COMPILER_VERSION="Not installed"
59+
fi
60+
61+
if [[ "${USE_IPEX:-}" == "1" ]]; then
62+
export BENCHMARKING_METHOD="PYTORCH_LEGACY_PROFILER_USING_IPEX"
63+
elif [[ "${USE_IPEX:-}" == "0" ]]; then
64+
export BENCHMARKING_METHOD="ELAPSED_TIME"
65+
fi
66+
4967
if [ "$QUIET" = false ]; then
5068
echo "LIBIGC1_VERSION=$LIBIGC1_VERSION"
5169
echo "LEVEL_ZERO_VERSION=$LEVEL_ZERO_VERSION"
5270
echo "AGAMA_VERSION=$AGAMA_VERSION"
5371
echo "GPU_DEVICE=$GPU_DEVICE"
72+
echo "TORCH_VERSION=$TORCH_VERSION"
73+
echo "COMPILER_VERSION=$COMPILER_VERSION"
74+
if [[ ! "${BENCHMARKING_METHOD:-}" = "" ]]; then
75+
echo "BENCHMARKING_METHOD=$BENCHMARKING_METHOD"
76+
fi
5477
fi

0 commit comments

Comments
 (0)