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

[Testing] Add decorator tvm.testing.requires_cuda_compute_version #12778

Merged
merged 2 commits into from
Sep 16, 2022
Merged
Changes from 1 commit
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
Prev Previous commit
requires_cuda_compute_version skips test when no GPU is present
Lunderberg committed Sep 15, 2022
commit 1862459d464e6b915602ab0be20b9684378b0e41
9 changes: 7 additions & 2 deletions python/tvm/testing/utils.py
Original file line number Diff line number Diff line change
@@ -1078,8 +1078,13 @@ def requires_cuda_compute_version(major_version, minor_version=0):
The minor version of the (major,minor) version tuple.
"""
min_version = (major_version, minor_version)
arch = tvm.contrib.nvcc.get_target_compute_version()
compute_version = tvm.contrib.nvcc.parse_compute_version(arch)
try:
arch = tvm.contrib.nvcc.get_target_compute_version()
compute_version = tvm.contrib.nvcc.parse_compute_version(arch)
except ValueError:
# No GPU present. This test will be skipped from the
# requires_cuda() marks as well.
compute_version = (0, 0)

min_version_str = ".".join(str(v) for v in min_version)
compute_version_str = ".".join(str(v) for v in compute_version)