Skip to content

Commit 2bf271b

Browse files
committed
compiler: add local array with fixed size type
1 parent 19d61fe commit 2bf271b

File tree

5 files changed

+14
-10
lines changed

5 files changed

+14
-10
lines changed

devito/ir/iet/visitors.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
c_restrict_void_p, sorted_priority)
2727
from devito.types.basic import AbstractFunction, AbstractSymbol, Basic
2828
from devito.types import (ArrayObject, CompositeObject, Dimension, Pointer,
29-
IndexedData, DeviceMap)
29+
IndexedData, DeviceMap, LocalObject)
3030

3131

3232
__all__ = ['FindApplications', 'FindNodes', 'FindWithin', 'FindSections',
@@ -353,7 +353,10 @@ def _gen_rettype(self, obj):
353353
elif isinstance(obj, (FieldFromComposite, FieldFromPointer)):
354354
return self._gen_value(obj.function.base, 0).typename
355355
else:
356-
return None
356+
try:
357+
return obj._type_.__name__
358+
except AttributeError:
359+
return None
357360

358361
def _args_decl(self, args):
359362
"""Generate cgen declarations from an iterable of symbols and expressions."""

devito/mpi/routines.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1395,7 +1395,7 @@ def _arg_values(self, args=None, **kwargs):
13951395
class AllreduceCall(Call):
13961396

13971397
def __init__(self, arguments, **kwargs):
1398-
super().__init__('MPI_Allreduce', arguments)
1398+
super().__init__('MPI_Allreduce', arguments, **kwargs)
13991399

14001400

14011401
class ReductionBuilder(object):
@@ -1422,6 +1422,6 @@ def make(self, dr):
14221422
op = self.mapper[dr.op]
14231423

14241424
arguments = [inplace, Byref(f), Integer(1), mpitype, op, comm]
1425-
allreduce = AllreduceCall(arguments)
1425+
allreduce = AllreduceCall(arguments, writes=f)
14261426

14271427
return allreduce

devito/symbolics/extended_sympy.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,9 +172,9 @@ def __new__(cls, call, pointer, params=None, **kwargs):
172172
pointer = Symbol(pointer)
173173
if isinstance(call, str):
174174
call = Symbol(call)
175-
elif not isinstance(call, Basic):
176-
raise ValueError("`call` must be a `devito.Basic` or a type "
177-
"with compatible interface")
175+
elif not isinstance(call, (BasicWrapperMixin, Basic)):
176+
raise ValueError(f"`call` {call} must be a `devito.Basic` or a type "
177+
f"with compatible interface, not {type(call)}")
178178
_params = []
179179
for p in as_tuple(params):
180180
if isinstance(p, str):

devito/types/dense.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ def wrapper(self):
148148
# Perhaps user only wants to initialise the physical domain
149149
self._initializer(self.data)
150150
else:
151-
self.data_with_halo.fill(0)
151+
self._data_allocated.fill(0)
152152

153153
return func(self)
154154
return wrapper
@@ -296,7 +296,8 @@ def shape_global(self):
296296

297297
@property
298298
def symbolic_shape(self):
299-
return tuple(self._C_get_field(FULL, d).size for d in self.dimensions)
299+
return DimensionTuple(*[self._C_get_field(FULL, d).size for d in self.dimensions],
300+
getters=self.dimensions)
300301

301302
@property
302303
def size_global(self):

devito/types/dimension.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1482,7 +1482,7 @@ def _arg_defaults(self, **kwargs):
14821482
def _arg_values(self, *args, **kwargs):
14831483
return {}
14841484

1485-
def _arg_check(self, *args):
1485+
def _arg_check(self, *args, **kwargs):
14861486
"""A CustomDimension performs no runtime checks."""
14871487
return
14881488

0 commit comments

Comments
 (0)