|
16 | 16 | from devito.types import FIndexed
|
17 | 17 |
|
18 | 18 | __all__ = ['avoid_denormals', 'hoist_prodders', 'relax_incr_dimensions',
|
19 |
| - 'generate_macros', 'minimize_symbols', 'complex_include'] |
| 19 | + 'generate_macros', 'minimize_symbols'] |
20 | 20 |
|
21 | 21 |
|
22 | 22 | @iet_pass
|
@@ -240,39 +240,6 @@ def minimize_symbols(iet):
|
240 | 240 | return iet, {}
|
241 | 241 |
|
242 | 242 |
|
243 |
| -_complex_lib = {'cuda': 'thrust/complex.h'} |
244 |
| - |
245 |
| - |
246 |
| -@iet_pass |
247 |
| -def complex_include(iet, language, compiler): |
248 |
| - """ |
249 |
| - Add headers for complex arithmetic |
250 |
| - """ |
251 |
| - # Check if there is complex numbers that always take dtype precedence |
252 |
| - max_dtype = np.result_type(*[f.dtype for f in FindSymbols().visit(iet)]) |
253 |
| - if not np.issubdtype(max_dtype, np.complexfloating): |
254 |
| - return iet, {} |
255 |
| - |
256 |
| - lib = (_complex_lib.get(language, 'complex' if compiler._cpp else 'complex.h'),) |
257 |
| - |
258 |
| - headers = {} |
259 |
| - |
260 |
| - # For openacc (cpp) need to define constant _Complex_I that isn't found otherwise |
261 |
| - if compiler._cpp: |
262 |
| - c_str = dtype_to_cstr(max_dtype.type(0).real.dtype.type) |
263 |
| - # Constant I |
264 |
| - headers = {('_Complex_I', ('std::complex<%s>(0.0, 1.0)' % c_str))} |
265 |
| - # Mix arithmetic definitions |
266 |
| - dest = compiler.get_jit_dir() |
267 |
| - hfile = dest.joinpath('stdcomplex_arith.h') |
268 |
| - if not hfile.is_file(): |
269 |
| - with open(str(hfile), 'w') as ff: |
270 |
| - ff.write(str(_stdcomplex_defs)) |
271 |
| - lib += (str(hfile),) |
272 |
| - |
273 |
| - return iet, {'includes': lib, 'headers': headers} |
274 |
| - |
275 |
| - |
276 | 243 | def remove_redundant_moddims(iet):
|
277 | 244 | key = lambda d: d.is_Modulo and d.origin is not None
|
278 | 245 | mds = [d for d in FindSymbols('dimensions').visit(iet) if key(d)]
|
@@ -351,39 +318,3 @@ def _rename_subdims(target, dimensions):
|
351 | 318 | return {d: d._rebuild(d.root.name) for d in dims
|
352 | 319 | if d.root not in dimensions
|
353 | 320 | and names.count(d.root.name) < 2}
|
354 |
| - |
355 |
| - |
356 |
| -_stdcomplex_defs = """ |
357 |
| -#include <complex> |
358 |
| -
|
359 |
| -template<typename _Tp, typename _Ti> |
360 |
| -std::complex<_Tp> operator * (const _Ti & a, const std::complex<_Tp> & b){ |
361 |
| - return std::complex<_Tp>(b.real() * a, b.imag() * a); |
362 |
| -} |
363 |
| -
|
364 |
| -template<typename _Tp, typename _Ti> |
365 |
| -std::complex<_Tp> operator * (const std::complex<_Tp> & b, const _Ti & a){ |
366 |
| - return std::complex<_Tp>(b.real() * a, b.imag() * a); |
367 |
| -} |
368 |
| -
|
369 |
| -template<typename _Tp, typename _Ti> |
370 |
| -std::complex<_Tp> operator / (const _Ti & a, const std::complex<_Tp> & b){ |
371 |
| - _Tp denom = b.real() * b.real () + b.imag() * b.imag() |
372 |
| - return std::complex<_Tp>(b.real() * a / denom, - b.imag() * a / denom); |
373 |
| -} |
374 |
| -
|
375 |
| -template<typename _Tp, typename _Ti> |
376 |
| -std::complex<_Tp> operator / (const std::complex<_Tp> & b, const _Ti & a){ |
377 |
| - return std::complex<_Tp>(b.real() / a, b.imag() / a); |
378 |
| -} |
379 |
| -
|
380 |
| -template<typename _Tp, typename _Ti> |
381 |
| -std::complex<_Tp> operator + (const _Ti & a, const std::complex<_Tp> & b){ |
382 |
| - return std::complex<_Tp>(b.real() + a, b.imag()); |
383 |
| -} |
384 |
| -
|
385 |
| -template<typename _Tp, typename _Ti> |
386 |
| -std::complex<_Tp> operator + (const std::complex<_Tp> & b, const _Ti & a){ |
387 |
| - return std::complex<_Tp>(b.real() + a, b.imag()); |
388 |
| -} |
389 |
| -""" |
0 commit comments