@@ -25,19 +25,20 @@ def _run_process(target):
2525 assert not p .exitcode
2626
2727
28- def _test_initialized ():
28+ def _test_uninitialized ():
2929 from cuda .core .system import _nvml_context
3030
31- assert _nvml_context ._NVML_STATE == INITIALIZED
31+ assert _nvml_context ._NVML_STATE == UNINITIALIZED
3232
3333
34- def test_initialized ():
35- _run_process (_test_initialized )
34+ def test_uninitialized ():
35+ _run_process (_test_uninitialized )
3636
3737
3838def _test_is_initialized ():
3939 from cuda .core .system import _nvml_context
4040
41+ _nvml_context .initialize ()
4142 assert _nvml_context ._NVML_STATE == INITIALIZED
4243 assert _nvml_context .is_initialized () is True
4344
@@ -46,20 +47,11 @@ def test_is_initialized():
4647 _run_process (_test_is_initialized )
4748
4849
49- def _test_uninitialized ():
50- from cuda .core .system import _nvml_context
51-
52- _nvml_context ._NVML_STATE = UNINITIALIZED
53- assert _nvml_context .is_initialized () is False
54-
55-
56- def test_uninitialized ():
57- _run_process (_test_uninitialized )
58-
59-
6050def _test_wrong_owner ():
6151 from cuda .core .system import _nvml_context
6252
53+ _nvml_context .initialize ()
54+
6355 _nvml_context ._NVML_OWNER_PID = 0
6456 assert _nvml_context .is_initialized () is False
6557
@@ -81,6 +73,8 @@ def test_wsl():
8173def _test_validate ():
8274 from cuda .core .system import _nvml_context
8375
76+ _nvml_context .initialize ()
77+
8478 assert _nvml_context .validate () is None
8579
8680
0 commit comments