Skip to content

Commit

Permalink
Fix nested multiprocessing in test
Browse files Browse the repository at this point in the history
This commit fixes the error:

```
[2020-08-20 06:00:35,606]  INFO - FAIL: test_visible_devices_set_after_import (numba.cuda.tests.cudadrv.test_runtime.TestRuntime)
[2020-08-20 06:00:35,606]  INFO - ----------------------------------------------------------------------
[2020-08-20 06:00:35,606]  INFO - Traceback (most recent call last):
[2020-08-20 06:00:35,606]  INFO -   File "<path>\testenv_b522e3de-5976-43cf-ae68-63c7d7c1f2a3\lib\site-packages\numba\cuda\tests\cudadrv\test_runtime.py", line 51, in test_visible_devices_set_after_import
[2020-08-20 06:00:35,606]  INFO -     p.start()
[2020-08-20 06:00:35,606]  INFO -   File "<path>\envs\testenv_b522e3de-5976-43cf-ae68-63c7d7c1f2a3\lib\multiprocessing\process.py", line 118, in start
[2020-08-20 06:00:35,606]  INFO -     assert not _current_process._config.get('daemon'), \
[2020-08-20 06:00:35,606]  INFO - AssertionError: daemonic processes are not allowed to have children
```

by putting `test_visible_devices_set_after_import` in its own test class
with a `SerialMixin`.
  • Loading branch information
gmarkall committed Aug 20, 2020
1 parent a8e0877 commit 9988d56
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion numba/cuda/tests/cudadrv/test_runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import os
from numba.core import config
from numba.cuda.cudadrv.runtime import runtime
from numba.cuda.testing import unittest
from numba.cuda.testing import unittest, SerialMixin


def set_visible_devices_and_check(q):
Expand All @@ -26,6 +26,8 @@ def test_get_version(self):
(10, 1), (10, 2), (11, 0))
self.assertIn(runtime.get_version(), supported_versions)


class TestVisibleDevices(unittest.TestCase, SerialMixin):
def test_visible_devices_set_after_import(self):
# See Issue #6149. This test checks that we can set
# CUDA_VISIBLE_DEVICES after importing Numba and have the value
Expand Down

0 comments on commit 9988d56

Please sign in to comment.