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

Correcting Misleading Test Skip Reasons. #7808

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
26 changes: 17 additions & 9 deletions tests/python/pytorch/graphbolt/impl/test_gpu_cached_feature.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,22 @@
path = os.path.join(test_dir, name + ".npy")
np.save(path, t.cpu().numpy())
return path

Check warning on line 18 in tests/python/pytorch/graphbolt/impl/test_gpu_cached_feature.py

View workflow job for this annotation

GitHub Actions / lintrunner

UFMT format

Run `lintrunner -a` to apply this patch.
def _skip_condition_CachedFeature():
drivanov marked this conversation as resolved.
Show resolved Hide resolved
return (F._default_context_str != "gpu") or \
(torch.cuda.get_device_capability()[0] < 7)


def _reson_to_skip_CachedFeature():
drivanov marked this conversation as resolved.
Show resolved Hide resolved
if F._default_context_str != "gpu":
return "GPUCachedFeature tests are available only on GPU."
drivanov marked this conversation as resolved.
Show resolved Hide resolved

return "GPUCachedFeature requires a Volta or later generation NVIDIA GPU."


@unittest.skipIf(
F._default_context_str != "gpu"
or torch.cuda.get_device_capability()[0] < 7,
reason="GPUCachedFeature requires a Volta or later generation NVIDIA GPU.",
_skip_condition_CachedFeature(),
reason=_reson_to_skip_CachedFeature(),
)
@pytest.mark.parametrize(
"dtype",
Expand Down Expand Up @@ -116,9 +126,8 @@


@unittest.skipIf(
F._default_context_str != "gpu"
or torch.cuda.get_device_capability()[0] < 7,
reason="GPUCachedFeature requires a Volta or later generation NVIDIA GPU.",
_skip_condition_CachedFeature(),
reason=_reson_to_skip_CachedFeature(),
)
@pytest.mark.parametrize(
"dtype",
Expand Down Expand Up @@ -155,9 +164,8 @@


@unittest.skipIf(
F._default_context_str != "gpu"
or torch.cuda.get_device_capability()[0] < 7,
reason="GPUCachedFeature requires a Volta or later generation NVIDIA GPU.",
_skip_condition_CachedFeature(),
reason=_reson_to_skip_CachedFeature(),
)
@unittest.skipIf(
not torch.ops.graphbolt.detect_io_uring(),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import unittest

Check warning on line 1 in tests/python/pytorch/graphbolt/impl/test_hetero_cached_feature.py

View workflow job for this annotation

GitHub Actions / lintrunner

UFMT format

Run `lintrunner -a` to apply this patch.
import backend as F

import pytest
Expand All @@ -6,17 +7,17 @@
from dgl import graphbolt as gb


@unittest.skipIf(
F._default_context_str != "gpu"
or torch.cuda.get_device_capability()[0] < 7,
reason="GPUCachedFeature tests are available only on GPU."
if F._default_context_str != "gpu"
else "GPUCachedFeature requires a Volta or later generation NVIDIA GPU.",
)
@pytest.mark.parametrize(
"cached_feature_type", [gb.cpu_cached_feature, gb.gpu_cached_feature]
)
def test_hetero_cached_feature(cached_feature_type):
if cached_feature_type == gb.gpu_cached_feature and (
F._default_context_str != "gpu"
or torch.cuda.get_device_capability()[0] < 7
):
pytest.skip(
"GPUCachedFeature requires a Volta or later generation NVIDIA GPU."
drivanov marked this conversation as resolved.
Show resolved Hide resolved
)
device = F.ctx() if cached_feature_type == gb.gpu_cached_feature else None
pin_memory = cached_feature_type == gb.gpu_cached_feature

Expand Down
Loading