diff --git a/numba_cuda/numba/cuda/dispatcher.py b/numba_cuda/numba/cuda/dispatcher.py index d9a2667b7..4a976bcef 100644 --- a/numba_cuda/numba/cuda/dispatcher.py +++ b/numba_cuda/numba/cuda/dispatcher.py @@ -256,7 +256,11 @@ def bind(self): """ cufunc = self._codelibrary.get_cufunc() - if hasattr(self, "target_context") and self.target_context.enable_nrt: + if ( + hasattr(self, "target_context") + and self.target_context.enable_nrt + and config.CUDA_NRT_STATS + ): rtsys.ensure_initialized() rtsys.set_memsys_to_module(cufunc.module) # We don't know which stream the kernel will be launched on, so diff --git a/numba_cuda/numba/cuda/tests/nrt/test_nrt.py b/numba_cuda/numba/cuda/tests/nrt/test_nrt.py index edc329144..3966e35e5 100644 --- a/numba_cuda/numba/cuda/tests/nrt/test_nrt.py +++ b/numba_cuda/numba/cuda/tests/nrt/test_nrt.py @@ -171,7 +171,10 @@ def foo(): arr = cuda_arange(5 * tmp[0]) # noqa: F841 return None - with override_config('CUDA_ENABLE_NRT', True): + with ( + override_config('CUDA_ENABLE_NRT', True), + override_config('CUDA_NRT_STATS', True) + ): # Switch on stats rtsys.memsys_enable_stats() # check the stats are on diff --git a/numba_cuda/numba/cuda/tests/nrt/test_nrt_refct.py b/numba_cuda/numba/cuda/tests/nrt/test_nrt_refct.py index 5873265d8..75a71154a 100644 --- a/numba_cuda/numba/cuda/tests/nrt/test_nrt_refct.py +++ b/numba_cuda/numba/cuda/tests/nrt/test_nrt_refct.py @@ -18,7 +18,10 @@ def tearDown(self): super(TestNrtRefCt, self).tearDown() def run(self, result=None): - with override_config("CUDA_ENABLE_NRT", True): + with ( + override_config("CUDA_ENABLE_NRT", True), + override_config('CUDA_NRT_STATS', True) + ): super(TestNrtRefCt, self).run(result) def test_no_return(self):