diff --git a/conftest.py b/conftest.py index 81d143eb7a..f14d595f78 100644 --- a/conftest.py +++ b/conftest.py @@ -174,8 +174,7 @@ def parallel(item, m): testname = get_testname(item) # Only spew tracebacks on rank 0. # Run xfailing tests to ensure that errors are reported to calling process - args = ["-n", "1", pyversion, "-m", "pytest", "--no-summary", "-s", - "--runxfail", "-qq", testname] + args = ["-n", "1", pyversion, "-m", "pytest", "-s", "--runxfail", "-qq", testname] if nprocs > 1: args.extend([":", "-n", "%d" % (nprocs - 1), pyversion, "-m", "pytest", "-s", "--runxfail", "--tb=no", "-qq", "--no-summary", testname]) @@ -203,7 +202,8 @@ def decoupler(item, m): testname = get_testname(item) pyversion = sys.executable - call = [pyversion, "-m", "pytest", "--no-summary", "-s", "--runxfail", testname] + args = ["-n", "1", pyversion, "-m", "pytest", "-s", "--runxfail", testname] + call = [mpi_exec] + args return set_run_reset(env_vars, call) diff --git a/devito/arch/archinfo.py b/devito/arch/archinfo.py index ce17ecfc13..db1b329ed3 100644 --- a/devito/arch/archinfo.py +++ b/devito/arch/archinfo.py @@ -804,9 +804,13 @@ def _mro(cls): def march(self): return None - @property + @cached_property def numa_domains(self): - raise NotImplementedError + info = get_gpu_info() + try: + return info['ncards'] + except KeyError: + return None @cached_property def memtotal(self): diff --git a/tests/test_pickle.py b/tests/test_pickle.py index 68d593e058..9b7a639a32 100644 --- a/tests/test_pickle.py +++ b/tests/test_pickle.py @@ -476,6 +476,29 @@ def test_receiver(self, pickle): assert np.all(new_rec.coordinates.data == [[0.], [1.], [2.]]) +class TestAdvanced: + + def test_foreign(self): + MySparseFunction = type('MySparseFunction', (SparseFunction,), {'attr': 42}) + + grid = Grid(shape=(3,)) + + msf = MySparseFunction(name='msf', grid=grid, npoint=3, space_order=2, + coordinates=[(0.,), (1.,), (2.,)]) + + # Plain `pickle` doesn't support pickling of dynamic classes + with pytest.raises(Exception): + pickle0.dumps(msf) + + # But `cloudpickle` does + pkl_msf = pickle1.dumps(msf) + new_msf = pickle1.loads(pkl_msf) + + assert new_msf.attr == 42 + assert new_msf.name == 'msf' + assert new_msf.npoint == 3 + + @pytest.mark.parametrize('pickle', [pickle0, pickle1]) class TestOperator: