Skip to content

Commit 8ec307c

Browse files
authored
Merge pull request #2636 from devitocodes/rcompile-default-partile
compiler: Privilege default par-tile with rcompile
2 parents e376a0d + 85fd909 commit 8ec307c

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

devito/core/gpu.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,16 +126,29 @@ def _rcompile_wrapper(cls, **kwargs0):
126126

127127
def wrapper(expressions, mode='default', options=None, **kwargs1):
128128
kwargs = {**kwargs0, **kwargs1}
129+
options = options or {}
129130

130131
if mode == 'host':
131-
options = options or {}
132132
target = {
133133
'platform': 'cpu64',
134134
'language': 'C' if options0['par-disabled'] else 'openmp',
135135
'compiler': 'custom'
136136
}
137137
else:
138-
options = {**options0, **(options or {})}
138+
# Always use the default `par-tile` for recursive compilation
139+
# unless the caller explicitly overrides it so that if the user
140+
# supplies a multi par-tile there is no need to worry about the
141+
# small kernels typically generated by recursive compilation
142+
par_tile0 = options0['par-tile']
143+
par_tile = options.get('par-tile')
144+
if par_tile0 and par_tile:
145+
options = {**options0, **options, 'par-tile': par_tile}
146+
elif par_tile0:
147+
par_tile = ParTile(par_tile0.default, default=par_tile0.default)
148+
options = {**options0, **options, 'par-tile': par_tile}
149+
else:
150+
options = {**options0, **options}
151+
139152
target = None
140153

141154
return rcompile(expressions, kwargs, options, target=target)

0 commit comments

Comments
 (0)