Skip to content

Commit bc9155d

Browse files
disable triton test if no GPU available
Signed-off-by: cliu-us <[email protected]>
1 parent 5ac2dd1 commit bc9155d

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

tests/triton_kernels/test_triton_mm.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@
3737
)
3838
def test_triton_matmul_fp(mkn, dtype_to_test):
3939
"""Parametric tests for triton matmul kernel using variety of tensor sizes and dtypes."""
40+
if not torch.cuda.is_available():
41+
# only run the test when GPU is available
42+
return
43+
4044
torch.manual_seed(23)
4145
m = n = k = mkn
4246
a = torch.randn((m, k), device="cuda", dtype=torch.float)
@@ -70,6 +74,10 @@ def test_triton_matmul_fp(mkn, dtype_to_test):
7074
@pytest.mark.parametrize("mkn", [64, 256, 1024, 4096])
7175
def test_triton_matmul_int8(mkn):
7276
"""Parametric tests for triton imatmul kernel using variety of tensor sizes."""
77+
if not torch.cuda.is_available():
78+
# only run the test when GPU is available
79+
return
80+
7381
torch.manual_seed(23)
7482
m = n = k = mkn
7583
a = torch.randint(-128, 127, (m, k), device="cuda", dtype=torch.int8)
@@ -93,6 +101,9 @@ def test_linear_fpx_acc(feat_in_out, trun_bits):
93101
"""Parametric tests for LinearFPxAcc. This Linear utilizes triton kernel hence can only be run
94102
on CUDA.
95103
"""
104+
if not torch.cuda.is_available():
105+
# only run the test when GPU is available
106+
return
96107

97108
torch.manual_seed(23)
98109
feat_in, feat_out = feat_in_out

0 commit comments

Comments
 (0)