Skip to content

Commit 1d32e14

Browse files
committed
pass --report-api-errors=no to sanitizer to avoid tripping it due to API errors
1 parent 9ef1562 commit 1d32e14

File tree

9 files changed

+3
-36
lines changed

9 files changed

+3
-36
lines changed

ci/tools/setup-sanitizer

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,11 @@ set -euo pipefail
1212
if [[ "${SETUP_SANITIZER}" == 1 ]]; then
1313
COMPUTE_SANITIZER="${CUDA_HOME}/bin/compute-sanitizer"
1414
COMPUTE_SANITIZER_VERSION=$(${COMPUTE_SANITIZER} --version | grep -Eo "[0-9]{4}\.[0-9]\.[0-9]" | sed -e 's/\.//g')
15-
SANITIZER_CMD="${COMPUTE_SANITIZER} --target-processes=all --launch-timeout=0 --tool=memcheck --error-exitcode=1"
15+
SANITIZER_CMD="${COMPUTE_SANITIZER} --target-processes=all --launch-timeout=0 --tool=memcheck --error-exitcode=1 --report-api-errors=no"
1616
if [[ "$COMPUTE_SANITIZER_VERSION" -ge 202111 ]]; then
1717
SANITIZER_CMD="${SANITIZER_CMD} --padding=32"
1818
fi
19+
# TODO: remove me
1920
echo "CUDA_PYTHON_TESTING_WITH_COMPUTE_SANITIZER=1" >> $GITHUB_ENV
2021
else
2122
SANITIZER_CMD=""

cuda_bindings/tests/conftest.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,6 @@
55

66
import pytest
77

8-
skipif_testing_with_compute_sanitizer = pytest.mark.skipif(
9-
os.environ.get("CUDA_PYTHON_TESTING_WITH_COMPUTE_SANITIZER", "0") == "1",
10-
reason="The compute-sanitizer is running, and this test causes an API error.",
11-
)
12-
138

149
def pytest_configure(config):
1510
config.custom_info = []

cuda_bindings/tests/test_cuda.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
import numpy as np
99
import pytest
10-
from conftest import skipif_testing_with_compute_sanitizer
1110

1211
import cuda.cuda as cuda
1312
import cuda.cudart as cudart
@@ -80,7 +79,6 @@ def test_cuda_memcpy():
8079
assert err == cuda.CUresult.CUDA_SUCCESS
8180

8281

83-
@skipif_testing_with_compute_sanitizer
8482
def test_cuda_array():
8583
(err,) = cuda.cuInit(0)
8684
assert err == cuda.CUresult.CUDA_SUCCESS
@@ -234,7 +232,6 @@ def test_cuda_uuid_list_access():
234232
assert err == cuda.CUresult.CUDA_SUCCESS
235233

236234

237-
@skipif_testing_with_compute_sanitizer
238235
def test_cuda_cuModuleLoadDataEx():
239236
(err,) = cuda.cuInit(0)
240237
assert err == cuda.CUresult.CUDA_SUCCESS
@@ -622,7 +619,6 @@ def test_cuda_coredump_attr():
622619
assert err == cuda.CUresult.CUDA_SUCCESS
623620

624621

625-
@skipif_testing_with_compute_sanitizer
626622
def test_get_error_name_and_string():
627623
(err,) = cuda.cuInit(0)
628624
assert err == cuda.CUresult.CUDA_SUCCESS
@@ -952,7 +948,6 @@ def test_CUmemDecompressParams_st():
952948
assert int(desc.dstActBytes) == 0
953949

954950

955-
@skipif_testing_with_compute_sanitizer
956951
def test_all_CUresult_codes():
957952
max_code = int(max(cuda.CUresult))
958953
# Smoke test. CUDA_ERROR_UNKNOWN = 999, but intentionally using literal value.
@@ -985,21 +980,18 @@ def test_all_CUresult_codes():
985980
assert num_good >= 76 # CTK 11.0.3_450.51.06
986981

987982

988-
@skipif_testing_with_compute_sanitizer
989983
def test_cuKernelGetName_failure():
990984
err, name = cuda.cuKernelGetName(0)
991985
assert err == cuda.CUresult.CUDA_ERROR_INVALID_VALUE
992986
assert name is None
993987

994988

995-
@skipif_testing_with_compute_sanitizer
996989
def test_cuFuncGetName_failure():
997990
err, name = cuda.cuFuncGetName(0)
998991
assert err == cuda.CUresult.CUDA_ERROR_INVALID_VALUE
999992
assert name is None
1000993

1001994

1002-
@skipif_testing_with_compute_sanitizer
1003995
@pytest.mark.skipif(
1004996
driverVersionLessThan(12080) or not supportsCudaAPI("cuCheckpointProcessGetState"),
1005997
reason="When API was introduced",

cuda_bindings/tests/test_cudart.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
import numpy as np
88
import pytest
9-
from conftest import skipif_testing_with_compute_sanitizer
109

1110
import cuda.cuda as cuda
1211
import cuda.cudart as cudart
@@ -67,7 +66,6 @@ def test_cudart_memcpy():
6766
assertSuccess(err)
6867

6968

70-
@skipif_testing_with_compute_sanitizer
7169
def test_cudart_hostRegister():
7270
# Use hostRegister API to check for correct enum return values
7371
page_size = 80

cuda_core/tests/conftest.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,5 @@ def pop_all_contexts():
6565
return pop_all_contexts
6666

6767

68-
skipif_testing_with_compute_sanitizer = pytest.mark.skipif(
69-
os.environ.get("CUDA_PYTHON_TESTING_WITH_COMPUTE_SANITIZER", "0") == "1",
70-
reason="The compute-sanitizer is running, and this test causes an API error.",
71-
)
72-
73-
7468
# TODO: make the fixture more sophisticated using path finder
7569
skipif_need_cuda_headers = pytest.mark.skipif(os.environ.get("CUDA_PATH") is None, reason="need CUDA header")

cuda_core/tests/test_cuda_utils.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
# SPDX-License-Identifier: LicenseRef-NVIDIA-SOFTWARE-LICENSE
44

55
import pytest
6-
from conftest import skipif_testing_with_compute_sanitizer
76

87
from cuda.bindings import driver, runtime
98
from cuda.core.experimental._utils import cuda_utils
@@ -41,8 +40,6 @@ def test_runtime_cuda_error_explanations_health():
4140
assert not extra_expl
4241

4342

44-
# this test causes an API error when the driver is too old to know about all of the error codes
45-
@skipif_testing_with_compute_sanitizer
4643
def test_check_driver_error():
4744
num_unexpected = 0
4845
for error in driver.CUresult:

cuda_core/tests/test_event.py

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

88
import numpy as np
99
import pytest
10-
from conftest import skipif_need_cuda_headers, skipif_testing_with_compute_sanitizer
10+
from conftest import skipif_need_cuda_headers
1111

1212
import cuda.core.experimental
1313
from cuda.core.experimental import Device, EventOptions, LaunchConfig, Program, ProgramOptions, launch
@@ -71,7 +71,6 @@ def test_is_done(init_cuda):
7171
assert event.is_done in (True, False)
7272

7373

74-
@skipif_testing_with_compute_sanitizer
7574
def test_error_timing_disabled():
7675
device = Device()
7776
device.set_current()
@@ -94,7 +93,6 @@ def test_error_timing_disabled():
9493
event2 - event1
9594

9695

97-
@skipif_testing_with_compute_sanitizer
9896
def test_error_timing_recorded():
9997
device = Device()
10098
device.set_current()
@@ -114,7 +112,6 @@ def test_error_timing_recorded():
114112
event3 - event2
115113

116114

117-
@skipif_testing_with_compute_sanitizer
118115
@skipif_need_cuda_headers # libcu++
119116
@pytest.mark.skipif(tuple(int(i) for i in np.__version__.split(".")[:2]) < (2, 1), reason="need numpy 2.1.0+")
120117
def test_error_timing_incomplete():

cuda_core/tests/test_linker.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
# SPDX-License-Identifier: LicenseRef-NVIDIA-SOFTWARE-LICENSE
44

55
import pytest
6-
from conftest import skipif_testing_with_compute_sanitizer
76

87
from cuda.core.experimental import Device, Linker, LinkerOptions, Program, ProgramOptions, _linker
98
from cuda.core.experimental._module import ObjectCode
@@ -145,8 +144,6 @@ def test_linker_link_invalid_target_type(compile_ptx_functions):
145144
linker.link("invalid_target")
146145

147146

148-
# this test causes an API error when using the culink API
149-
@skipif_testing_with_compute_sanitizer
150147
def test_linker_get_error_log(compile_ptx_functions):
151148
options = LinkerOptions(name="ABC", arch=ARCH)
152149

cuda_core/tests/test_module.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import warnings
77

88
import pytest
9-
from conftest import skipif_testing_with_compute_sanitizer
109

1110
import cuda.core.experimental
1211
from cuda.core.experimental import Device, ObjectCode, Program, ProgramOptions, system
@@ -181,7 +180,6 @@ def test_object_code_handle(get_saxpy_object_code):
181180
assert mod.handle is not None
182181

183182

184-
@skipif_testing_with_compute_sanitizer
185183
def test_saxpy_arguments(get_saxpy_kernel, cuda12_prerequisite_check):
186184
if not cuda12_prerequisite_check:
187185
pytest.skip("Test requires CUDA 12")
@@ -212,7 +210,6 @@ class ExpectedStruct(ctypes.Structure):
212210
assert all(actual == expected for actual, expected in zip(sizes, expected_sizes))
213211

214212

215-
@skipif_testing_with_compute_sanitizer
216213
@pytest.mark.parametrize("nargs", [0, 1, 2, 3, 16])
217214
@pytest.mark.parametrize("c_type_name,c_type", [("int", ctypes.c_int), ("short", ctypes.c_short)], ids=["int", "short"])
218215
def test_num_arguments(init_cuda, nargs, c_type_name, c_type, cuda12_prerequisite_check):
@@ -238,7 +235,6 @@ class ExpectedStruct(ctypes.Structure):
238235
assert all([actual.size == expected.size for actual, expected in zip(arg_info, members)])
239236

240237

241-
@skipif_testing_with_compute_sanitizer
242238
def test_num_args_error_handling(deinit_all_contexts_function, cuda12_prerequisite_check):
243239
if not cuda12_prerequisite_check:
244240
pytest.skip("Test requires CUDA 12")

0 commit comments

Comments
 (0)