Skip to content
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

Add --device_only arg to test_bench.py #2542

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ def pytest_addoption(parser):
action="store_true",
help="Run benchmarks on mps only and ignore machine configuration checks",
)
parser.addoption(
"--device_only",
action="store",
default=None,
help="Run benchmarks on the specific device only and ignore machine configuration checks",
)


def set_fuser(fuser):
Expand Down
3 changes: 3 additions & 0 deletions test_bench.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ def pytest_generate_tests(metafunc):
if hasattr(torch.backends, "mps") and torch.backends.mps.is_available():
devices.append("mps")

if device_only := metafunc.config.option.device_only:
devices = [device_only]

if metafunc.config.option.cpu_only:
devices = ["cpu"]
Comment on lines +34 to 38
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Look, device_only arg has lower priority, pytest test_bench.py --cpu_only --device_only cuda will make benchmarks to run on cpu deivices.


Expand Down