Skip to content

Commit 8f9f7b5

Browse files
authored
Fix slow test_patterngen_seeds on Windows by sampling (#1461)
Replace exhaustive O(n²) pairwise seed testing with prime-stride sampling, reducing iterations from ~32k to ~100 while maintaining meaningful coverage. Closes #1455
1 parent 6bf6338 commit 8f9f7b5

1 file changed

Lines changed: 4 additions & 6 deletions

File tree

cuda_core/tests/test_helpers.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,6 @@ def test_latchkernel():
4747
log("done")
4848

4949

50-
@pytest.mark.skipif(
51-
IS_WINDOWS,
52-
reason="Extremely slow on Windows (issue #1455).",
53-
)
5450
@pytest.mark.skipif(
5551
under_compute_sanitizer(),
5652
reason="Too slow under compute-sanitizer (UVM-heavy test).",
@@ -62,11 +58,13 @@ def test_patterngen_seeds():
6258
buffer = make_scratch_buffer(device, 0, NBYTES)
6359

6460
# All seeds are pairwise different.
61+
# We test a sampling of values because exhaustive testing is too slow,
62+
# especially on Windows. See https://github.com/NVIDIA/cuda-python/issues/1455
6563
pgen = PatternGen(device, NBYTES)
66-
for i in range(256):
64+
for i in (ii for ii in range(0, 256) if ii < 5 or ii % 17 == 0):
6765
pgen.fill_buffer(buffer, seed=i)
6866
pgen.verify_buffer(buffer, seed=i)
69-
for j in range(i + 1, 256):
67+
for j in (jj for jj in range(i + 1, 256) if jj < 5 or jj % 19 == 0):
7068
with pytest.raises(AssertionError):
7169
pgen.verify_buffer(buffer, seed=j)
7270

0 commit comments

Comments
 (0)