Skip to content

Commit 666ed11

Browse files
committed
Merge remote-tracking branch 'origin/bug-device-ordinal' into bug-device-ordinal
2 parents aa007af + 08c327b commit 666ed11

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

cuda_core/cuda/core/experimental/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
from cuda.core.experimental import utils
66
from cuda.core.experimental._device import Device
7-
from cuda.core.experimental._event import EventOptions
7+
from cuda.core.experimental._event import Event, EventOptions
88
from cuda.core.experimental._launcher import LaunchConfig, launch
99
from cuda.core.experimental._linker import Linker, LinkerOptions
1010
from cuda.core.experimental._module import ObjectCode

cuda_core/tests/test_event.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
# this software and related documentation outside the terms of the EULA
77
# is strictly prohibited.
88

9+
import os
910
import time
1011

1112
import pytest
@@ -37,8 +38,13 @@ def test_timing(init_cuda, enable_timing):
3738
# We only want to exercise the __sub__ method, this test is not meant
3839
# to stress-test the CUDA driver or time.sleep().
3940
delay_ms = delay_seconds * 1000
40-
generous_tolerance = 20
41-
assert delay_ms <= elapsed_time_ms < delay_ms + generous_tolerance
41+
if os.name == "nt": # noqa: SIM108
42+
# For Python <=3.10, the Windows timer resolution is typically limited to 15.6 ms by default.
43+
generous_tolerance = 100
44+
else:
45+
# Most modern Linux kernels have a default timer resolution of 1 ms.
46+
generous_tolerance = 20
47+
assert delay_ms - generous_tolerance <= elapsed_time_ms < delay_ms + generous_tolerance
4248
else:
4349
with pytest.raises(RuntimeError) as e:
4450
elapsed_time_ms = e2 - e1

0 commit comments

Comments
 (0)