File tree 2 files changed +9
-3
lines changed 2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change 4
4
5
5
from cuda .core .experimental import utils
6
6
from cuda .core .experimental ._device import Device
7
- from cuda .core .experimental ._event import EventOptions
7
+ from cuda .core .experimental ._event import Event , EventOptions
8
8
from cuda .core .experimental ._launcher import LaunchConfig , launch
9
9
from cuda .core .experimental ._linker import Linker , LinkerOptions
10
10
from cuda .core .experimental ._module import ObjectCode
Original file line number Diff line number Diff line change 6
6
# this software and related documentation outside the terms of the EULA
7
7
# is strictly prohibited.
8
8
9
+ import os
9
10
import time
10
11
11
12
import pytest
@@ -37,8 +38,13 @@ def test_timing(init_cuda, enable_timing):
37
38
# We only want to exercise the __sub__ method, this test is not meant
38
39
# to stress-test the CUDA driver or time.sleep().
39
40
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
42
48
else :
43
49
with pytest .raises (RuntimeError ) as e :
44
50
elapsed_time_ms = e2 - e1
You can’t perform that action at this time.
0 commit comments