Skip to content

Commit d24e6e1

Browse files
committed
compiler: fix header order
1 parent 8f4f221 commit d24e6e1

2 files changed

Lines changed: 6 additions & 10 deletions

File tree

devito/passes/iet/misc.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,9 @@ def _generate_macros(iet, tracker=None, lang=None, **kwargs):
166166
# so we need to include the respective includes
167167
limits = FindApplications(ValueLimit).visit(iet)
168168
if limits & (set(limits_mapper[np.int32]) | set(limits_mapper[np.int64])):
169-
includes.add('limits.h')
169+
includes.append('limits.h')
170170
elif limits & (set(limits_mapper[np.float32]) | set(limits_mapper[np.float64])):
171-
includes.add('float.h')
171+
includes.append('float.h')
172172

173173
return iet, {'headers': headers, 'includes': includes}
174174

devito/symbolics/extended_dtypes.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from devito.symbolics.extended_sympy import ReservedWord, Cast, ValueLimit
55
from devito.tools import (Bunch, float2, float3, float4, double2, double3, double4, # noqa
66
int2, int3, int4, ctypes_vector_mapper)
7+
from devito.tools.dtypes_lowering import mapper as dtype_mapper
78

89
__all__ = ['cast_mapper', 'CustomType', 'limits_mapper', 'INT', 'FLOAT', 'BaseCast', # noqa
910
'DOUBLE', 'VOID', 'NoDeclStruct', 'c_complex', 'c_double_complex']
@@ -69,8 +70,6 @@ def cast_mapper(arg):
6970
return lambda v, dtype=None, **kw: Cast(v, dtype=arg, **kw)
7071

7172

72-
FLOAT = cast_mapper(np.float32)
73-
DOUBLE = cast_mapper(np.float64)
7473
ULONG = cast_mapper(np.uint64)
7574
UINTP = cast_mapper((np.uint32, '*'))
7675

@@ -88,13 +87,10 @@ class VOID(BaseCast):
8887
_dtype = 'void'
8988

9089

91-
class INT(BaseCast):
92-
93-
_dtype = np.int32
94-
95-
9690
# Dynamically create INT, INT2, .... INTP, INT2P, ... FLOAT, ...
97-
for base_name in ['int', 'float', 'double']:
91+
for (base_name, dtype) in dtype_mapper.items():
92+
name = base_name.upper()
93+
globals()[name] = type(name, (BaseCast,), {'_dtype': dtype})
9894
for i in ['2', '3', '4']:
9995
v = '%s%s' % (base_name, i)
10096
globals()[v.upper()] = cast_mapper(v)

0 commit comments

Comments
 (0)