Skip to content

Commit ebcfe29

Browse files
authored
Revert "[BE] Update upload bm results GHA (#7612)"
This reverts commit 702cfd6.
1 parent 702cfd6 commit ebcfe29

File tree

3 files changed

+18
-67
lines changed

3 files changed

+18
-67
lines changed

.github/actions/upload-benchmark-results/action.yml

Lines changed: 16 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,7 @@ name: Upload benchmark results
33
inputs:
44
benchmark-results-dir:
55
description: 'The path to the directory with all the results in JSON format'
6-
required: true
7-
benchmark-name:
8-
description: 'Manually set the name of the benchmark'
9-
default: ''
6+
required: True
107
dry-run:
118
default: 'true'
129
schema-version:
@@ -15,6 +12,7 @@ inputs:
1512
default: ''
1613
venv:
1714
description: 'Path to virtual environment to activate'
15+
required: false
1816
default: ''
1917

2018
runs:
@@ -28,53 +26,26 @@ runs:
2826
if [[ -n "${{ inputs.venv }}" ]]; then
2927
source "${{ inputs.venv }}"
3028
fi
31-
python3 -mpip install boto3==1.35.33 psutil==7.0.0 nvidia-ml-py==13.580.82
29+
python3 -mpip install boto3==1.35.33 psutil==7.0.0 pynvml==12.0.0
3230
33-
- name: Get device name
34-
shell: bash
35-
run: |
36-
set -eux
31+
DEVICE_NAME=""
32+
DEVICE_TYPE=""
3733
3834
if command -v nvidia-smi; then
39-
DEVICE_NAME=cuda
40-
nvidia-smi
41-
elif command -v rocm-smi; then
35+
# NB: I'm using PyTorch here to get the device name, however, it needs to
36+
# install the correct version of PyTorch manually for now. Any PyTorch
37+
# version is fine, I just use 2.7.1 to satify PYPIDEP linter
38+
python3 -mpip install torch==2.7.1
39+
elif command -v rocminfo; then
40+
# NB: Installing torch on ROCm runner with pip here causes CI to fail
41+
# with a memoryview is too large error only on MI300 runners. Is pip
42+
# version on ROCm runner there too old? As a workaround, let's use the
43+
# GPU device name coming from rocminfo instead
4244
DEVICE_NAME=rocm
43-
rocm-smi
44-
elif command -v hl-smi; then
45-
DEVICE_NAME=hpu
46-
hl-smi
47-
else
48-
arch=$(uname -m)
49-
50-
case "$arch" in
51-
aarch64|arm64)
52-
DEVICE_NAME=arm64-cpu
53-
;;
54-
*)
55-
DEVICE_NAME=cpu
56-
;;
57-
esac
58-
lscpu
59-
fi
60-
echo "DEVICE_NAME=$DEVICE_NAME" >> $GITHUB_ENV
61-
62-
- name: Get device type
63-
shell: bash
64-
run: |
65-
set -eux
66-
67-
if [[ "${DEVICE_NAME}" == "cuda" ]]; then
68-
DEVICE_TYPE=$(nvidia-smi -i 0 --query-gpu=name --format=csv,noheader | awk '{print $2}')
69-
elif [[ "${DEVICE_NAME}" == "rocm" ]]; then
7045
DEVICE_TYPE=$(rocminfo | grep "Marketing Name" | tail -n1 | awk -F':' '{print $2}' | xargs)
71-
elif [[ "${DEVICE_NAME}" == "hpu" ]]; then
72-
DEVICE_TYPE="Intel Gaudi3 "$(hl-smi -q | grep "Product Name" | head -n 1 | awk -F ':' '{print $2}' | sed 's/^ *//')
73-
elif [[ "${DEVICE_NAME}" == "cpu" ]]; then
74-
DEVICE_TYPE="$(lscpu | grep "Model name" | sed -E 's/.*Model name:[[:space:]]*//; s/Intel\(R\)//g; s/\(R\)//g; s/\(TM\)//g; s/CPU//g; s/Processor//g; s/[[:space:]]+/ /g; s/^ //; s/ $//; s/ /_/g')_$(awk -F: '/Core\(s\) per socket/ {c=$2} /Socket\(s\)/ {s=$2} END {gsub(/ /,"",c); gsub(/ /,"",s); printf "%sc", c*s}' < <(lscpu))"
75-
elif [[ "${DEVICE_NAME}" == "arm64-cpu" ]]; then
76-
DEVICE_TYPE=$(lscpu | grep 'Vendor ID' | cut -f 2 -d ":" | awk '{$1=$1}1' | cut -f 2 -d " ")
7746
fi
47+
48+
echo "DEVICE_NAME=$DEVICE_NAME" >> $GITHUB_ENV
7849
echo "DEVICE_TYPE=$DEVICE_TYPE" >> $GITHUB_ENV
7950
8051
- name: Check that GITHUB_TOKEN is defined
@@ -108,7 +79,6 @@ runs:
10879
RUN_ATTEMPT: ${{ github.run_attempt }}
10980
JOB_ID: ${{ inputs.github-token != '' && steps.get-job-id.outputs.job-id || '0' }}
11081
JOB_NAME: ${{ inputs.github-token != '' && steps.get-job-id.outputs.job-name || '' }}
111-
BENCHMARK_NAME: ${{ inputs.benchmark-name || '' }}
11282
run: |
11383
set -eux
11484
@@ -151,7 +121,6 @@ runs:
151121
shell: bash
152122
env:
153123
BENCHMARK_RESULTS_DIR: ${{ inputs.benchmark-results-dir }}
154-
BENCHMARK_NAME: ${{ inputs.benchmark-name || '' }}
155124
DRY_RUN: ${{ inputs.dry-run }}
156125
# Additional information about the benchmarks
157126
BENCHMARK_METADATA: ${{ steps.gather-metadata.outputs.metadata }}

.github/scripts/benchmarks/gather_metadata.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def main() -> None:
8383
metadata = {
8484
"timestamp": int(time.time()),
8585
"schema_version": args.schema_version,
86-
"name": os.getenv("BENCHMARK_NAME", args.job_name),
86+
"name": args.job_name,
8787
"repo": args.repo,
8888
"head_branch": args.head_branch,
8989
"head_sha": args.head_sha,

.github/scripts/upload_benchmark_results.py

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
import json
1111
import logging
1212
import os
13-
import sys
1413
import time
1514
from argparse import Action, ArgumentParser, Namespace
1615
from decimal import Decimal
@@ -186,7 +185,7 @@ def upload_to_dynamodb(
186185

187186

188187
def read_benchmark_results(filepath: str) -> List[Dict[str, Any]]:
189-
benchmark_results: List[Dict[str, Any]] = []
188+
benchmark_results = []
190189
with open(filepath) as f:
191190
try:
192191
r = json.load(f)
@@ -217,15 +216,6 @@ def read_benchmark_results(filepath: str) -> List[Dict[str, Any]]:
217216
except JSONDecodeError:
218217
warn(f"Invalid JSON {line}, skipping")
219218

220-
# Overwrite the benchmark name if needed
221-
if os.getenv("BENCHMARK_NAME"):
222-
benchmark_name = os.getenv("BENCHMARK_NAME")
223-
for bresult in benchmark_results:
224-
if bresult.get("benchmark", {}) and bresult.get("benchmark", {}).get(
225-
"name"
226-
):
227-
bresult["benchmark"]["name"] = benchmark_name
228-
229219
return benchmark_results
230220

231221

@@ -329,7 +319,6 @@ def upload_to_s3(
329319
def main() -> None:
330320
args = parse_args()
331321

332-
has_results_uploaded = False
333322
for file in os.listdir(args.benchmark_results_dir):
334323
if not file.endswith(".json"):
335324
continue
@@ -360,7 +349,6 @@ def main() -> None:
360349
if not benchmark_results:
361350
continue
362351

363-
has_results_uploaded = True
364352
upload_to_s3(
365353
s3_bucket=OSSCI_BENCHMARKS_BUCKET,
366354
filepath=filepath,
@@ -369,12 +357,6 @@ def main() -> None:
369357
dry_run=args.dry_run,
370358
)
371359

372-
# When there is no benchmark results, treat it as a failure. This is better
373-
# than failing silently.
374-
if not has_results_uploaded:
375-
warn(f"Find no benchmark results in {args.benchmark_results}")
376-
sys.exit(1)
377-
378360

379361
if __name__ == "__main__":
380362
main()

0 commit comments

Comments
 (0)