Skip to content

Commit

Permalink
Merge pull request #2385 from devitocodes/decoupler-exec
Browse files Browse the repository at this point in the history
compiler: Tweaks to enable decoupling on GPUs
  • Loading branch information
mloubout authored Jun 7, 2024
2 parents ac582e7 + 9c40360 commit 38c1709
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 5 deletions.
6 changes: 3 additions & 3 deletions conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down Expand Up @@ -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)

Expand Down
8 changes: 6 additions & 2 deletions devito/arch/archinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
23 changes: 23 additions & 0 deletions tests/test_pickle.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down

0 comments on commit 38c1709

Please sign in to comment.