Skip to content

Commit 85d57c2

Browse files
Andy-Jostleofang
andauthored
Set CU_CTX_SCHED_BLOCKING_SYNC option in tests. (NVIDIA#1209)
* Set CU_CTX_SCHED_BLOCKING_SYNC option in tests. * Update cuda_core/tests/conftest.py Co-authored-by: Leo Fang <leo80042@gmail.com> --------- Co-authored-by: Leo Fang <leo80042@gmail.com>
1 parent 36b8c5f commit 85d57c2

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

cuda_core/tests/conftest.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# SPDX-License-Identifier: Apache-2.0
33

44
import multiprocessing
5+
import os
56

67
import helpers
78
import pytest
@@ -29,6 +30,13 @@ def init_cuda():
2930
# TODO: rename this to e.g. init_context
3031
device = Device()
3132
device.set_current()
33+
34+
# Set option to avoid spin-waiting on synchronization.
35+
if int(os.environ.get("CUDA_CORE_TEST_BLOCKING_SYNC", 0)) != 0:
36+
handle_return(
37+
driver.cuDevicePrimaryCtxSetFlags(device.device_id, driver.CUctx_flags.CU_CTX_SCHED_BLOCKING_SYNC)
38+
)
39+
3240
yield
3341
_ = _device_unset_current()
3442

0 commit comments

Comments
 (0)