-
Notifications
You must be signed in to change notification settings - Fork 99
Add a script to gather runner info when uploading benchmark results #6425
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
8143f70
45496e9
57fbb6d
1928a55
eba605a
ef16ad0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"benchmark": {"name": "ExecuTorch", "mode": "inference", "extra_info": {"app_type": "IOS_APP", "benchmark_config": "{\"model\": \"edsr\", \"config\": \"xnnpack_q8\", \"device_name\": \"apple_iphone_15\", \"device_arn\": \"arn:aws:devicefarm:us-west-2:308535385114:devicepool:02a2cf0f-6d9b-45ee-ba1a-a086587469e6/3b5acd2e-92e2-4778-b651-7726bafe129d\"}"}}, "model": {"name": "edsr", "type": "OSS model", "backend": "xnnpack_q8"}, "metric": {"name": "peak_inference_mem_usage(mb)", "benchmark_values": [333.2014794921875], "target_value": 0, "extra_info": {"method": "forward"}}, "runners": [{"name": "Apple iPhone 15", "type": "iOS 18.0", "avail_mem_in_gb": 0, "total_mem_in_gb": 0}]} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
#!/usr/bin/env python3 | ||
# Copyright (c) Meta Platforms, Inc. and affiliates. | ||
# All rights reserved. | ||
# | ||
# This source code is licensed under the BSD-style license found in the | ||
# LICENSE file in the root directory of this source tree. | ||
|
||
import psutil | ||
import platform | ||
import socket | ||
import json | ||
import os | ||
from typing import Dict, Any | ||
|
||
|
||
def set_output(name: str, val: Any) -> None: | ||
if os.getenv("GITHUB_OUTPUT"): | ||
with open(str(os.getenv("GITHUB_OUTPUT")), "a") as env: | ||
print(f"{name}={val}", file=env) | ||
else: | ||
print(f"::set-output name={name}::{val}") | ||
|
||
|
||
def get_runner_info() -> Dict[str, Any]: | ||
device_name = "" | ||
device_type = "" | ||
|
||
try: | ||
import torch | ||
|
||
if torch.cuda.is_available(): | ||
# TODO (huydhn): only support CUDA and ROCm for now | ||
if torch.version.hip: | ||
device_name = "rocm" | ||
elif torch.version.cuda: | ||
device_name = "cuda" | ||
|
||
device_type = torch.cuda.get_device_name() | ||
|
||
except ImportError: | ||
pass | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. logging the error info to help debugging |
||
|
||
runner_info = { | ||
"cpu_info": platform.processor(), | ||
"cpu_count": psutil.cpu_count(), | ||
"avail_mem_in_gb": int(psutil.virtual_memory().total / (1024 * 1024 * 1024)), | ||
"extra_info": { | ||
"hostname": socket.gethostname(), | ||
}, | ||
} | ||
|
||
# TODO (huydhn): only support CUDA and ROCm for now | ||
if device_name and device_type: | ||
runner_info["name"] = device_name | ||
runner_info["type"] = device_type | ||
runner_info["gpu_count"] = torch.cuda.device_count() | ||
runner_info["avail_gpu_mem_in_gb"] = int( | ||
torch.cuda.get_device_properties(0).total_memory | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is each device has same memory? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yup, that's the regular setup |
||
* torch.cuda.device_count() | ||
/ (1024 * 1024 * 1024) | ||
) | ||
|
||
return runner_info | ||
|
||
|
||
def main() -> None: | ||
runner_info = get_runner_info() | ||
set_output("runners", json.dumps([runner_info])) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
Uh oh!
There was an error while loading. Please reload this page.