Skip to content

Commit 9db4915

Browse files
committed
misc: Tidy up leftovers
1 parent a98acc2 commit 9db4915

6 files changed

Lines changed: 15 additions & 20 deletions

File tree

devito/finite_differences/differentiable.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -650,8 +650,8 @@ class ComplexPart(Differentiable, sympy.core.function.Application):
650650

651651
def __new__(cls, *args, **kwargs):
652652
if len(args) != 1:
653-
raise ValueError(f"{cls.__name__} is constructed with exactly one arg;"
654-
f" {len(args)} were supplied.")
653+
raise ValueError(f"{cls.__name__} expects exactly one arg;"
654+
f" {len(args)} were supplied instead.")
655655

656656
return super().__new__(cls, *args, **kwargs)
657657

devito/ir/clusters/cluster.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -304,13 +304,12 @@ def dtype(self):
304304
"""
305305
dtypes = set()
306306
for i in self.exprs:
307-
# try:
308-
if np.issubdtype(i.dtype, np.generic):
309-
dtypes.add(i.dtype)
310-
# except TypeError:
311-
# print(i, type(i), i.dtype, np.issubdtype(i.dtype, np.generic))
312-
# # E.g. `i.dtype` is a ctypes pointer, which has no dtype equivalent
313-
# pass
307+
try:
308+
if np.issubdtype(i.dtype, np.generic):
309+
dtypes.add(i.dtype)
310+
except TypeError:
311+
# E.g. `i.dtype` is a ctypes pointer, which has no dtype equivalent
312+
pass
314313

315314
return infer_dtype(dtypes)
316315

devito/ir/equations/equation.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from devito.ir.support import (GuardFactor, Interval, IntervalGroup, IterationSpace,
99
Stencil, detect_io, detect_accesses)
1010
from devito.symbolics import IntDiv, limits_mapper, uxreplace
11-
from devito.tools import Pickable, Tag, frozendict, infer_dtype
11+
from devito.tools import Pickable, Tag, frozendict
1212
from devito.types import Eq, Inc, ReduceMax, ReduceMin, relational_min
1313

1414
__all__ = ['LoweredEq', 'ClusterizedEq', 'DummyEq', 'OpInc', 'OpMin', 'OpMax',
@@ -48,10 +48,7 @@ def directions(self):
4848

4949
@property
5050
def dtype(self):
51-
try:
52-
return infer_dtype({self.lhs.dtype, self.rhs.dtype} - {None})
53-
except AttributeError:
54-
return self.lhs.dtype
51+
return self.lhs.dtype
5552

5653
@property
5754
def state(self):

devito/passes/clusters/aliases.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -888,6 +888,7 @@ def lower_schedule(schedule, meta, sregistry, ftemps, min_dtype):
888888
else:
889889
# Degenerate case: scalar expression
890890
assert writeto.size == 0
891+
891892
dtype = sympy_dtype(pivot, base=meta.dtype, smin=min_dtype)
892893
obj = Temp(name=name, dtype=dtype)
893894
expression = Eq(obj, uxreplace(pivot, subs))

devito/passes/iet/langbase.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -461,15 +461,15 @@ def _(iet):
461461
List(body=[rank_decl, rank_init, call_ngpus, osdd_else]),
462462
)]
463463

464-
header = c.Comment('Begin of %s+MPI setup' % self.langbb['name'])
464+
header = c.Comment('Beginning of %s+MPI setup' % self.langbb['name'])
465465
footer = c.Comment('End of %s+MPI setup' % self.langbb['name'])
466466
else:
467467
body = lang_init + [Conditional(
468468
CondNe(deviceid, -1),
469469
self.langbb['set-device']([deviceid] + devicetype)
470470
)]
471471

472-
header = c.Comment('Begin of %s setup' % self.langbb['name'])
472+
header = c.Comment('Beginning of %s setup' % self.langbb['name'])
473473
footer = c.Comment('End of %s setup' % self.langbb['name'])
474474

475475
init = List(header=header, body=body, footer=footer)

examples/performance/01_gpu.ipynb

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,7 @@
9797
"OK, it's time to let Devito generate code for our solver!"
9898
]
9999
},
100-
{
101-
"cell_type": "code",
102-
"execution_count": 6,
100+
{ "cell_type": "code", "execution_count": 6,
103101
"metadata": {},
104102
"outputs": [],
105103
"source": [
@@ -271,7 +269,7 @@
271269
"\n",
272270
"int Kernel(const float c, struct dataobj *restrict u_vec, const float dt, const float h_x, const float h_y, const int time_M, const int time_m, const int x_M, const int x_m, const int y_M, const int y_m, const int deviceid, const int devicerm, struct profiler * timers)\n",
273271
"{\n",
274-
" /* Begin of OpenMP setup */\n",
272+
" /* Beginning of OpenMP setup */\n",
275273
" if (deviceid != -1)\n",
276274
" {\n",
277275
" omp_set_default_device(deviceid);\n",

0 commit comments

Comments
 (0)