From b867b3ba1b7b0aecdd9d4d159333f1b1dd6e18be Mon Sep 17 00:00:00 2001 From: Andy Jost Date: Mon, 3 Nov 2025 12:34:08 -0800 Subject: [PATCH 1/2] Set CU_CTX_SCHED_BLOCKING_SYNC option in tests. --- cuda_core/tests/conftest.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cuda_core/tests/conftest.py b/cuda_core/tests/conftest.py index 8d55a233bf7..d4bea56007b 100644 --- a/cuda_core/tests/conftest.py +++ b/cuda_core/tests/conftest.py @@ -2,6 +2,7 @@ # SPDX-License-Identifier: Apache-2.0 import multiprocessing +import os import helpers import pytest @@ -29,6 +30,13 @@ def init_cuda(): # TODO: rename this to e.g. init_context device = Device() device.set_current() + + # Set option to avoid spin-waiting on synchronization. + if os.environ.get("CUDA_CORE_TEST_BLOCKING_SYNC") is not None: + handle_return( + driver.cuDevicePrimaryCtxSetFlags(device.device_id, driver.CUctx_flags.CU_CTX_SCHED_BLOCKING_SYNC) + ) + yield _ = _device_unset_current() From e86d5b78b8bafbdc861580c56e1cbd11c655c8d0 Mon Sep 17 00:00:00 2001 From: Andy Jost Date: Tue, 4 Nov 2025 06:58:39 -0800 Subject: [PATCH 2/2] Update cuda_core/tests/conftest.py Co-authored-by: Leo Fang --- cuda_core/tests/conftest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cuda_core/tests/conftest.py b/cuda_core/tests/conftest.py index d4bea56007b..b1d3ebbb9bd 100644 --- a/cuda_core/tests/conftest.py +++ b/cuda_core/tests/conftest.py @@ -32,7 +32,7 @@ def init_cuda(): device.set_current() # Set option to avoid spin-waiting on synchronization. - if os.environ.get("CUDA_CORE_TEST_BLOCKING_SYNC") is not None: + if int(os.environ.get("CUDA_CORE_TEST_BLOCKING_SYNC", 0)) != 0: handle_return( driver.cuDevicePrimaryCtxSetFlags(device.device_id, driver.CUctx_flags.CU_CTX_SCHED_BLOCKING_SYNC) )