class Flags(utils.ConfigOptions): # These options are all false by default, but the defaults are # different with the @jit decorator (see targets.options.TargetOptions). OPTIONS = { # Enable loop-lifting 'enable_looplift': False, # Enable pyobject mode (in general) 'enable_pyobject': False, # Enable pyobject mode inside lifted loops 'enable_pyobject_looplift': False, # Force pyobject mode inside the whole function 'force_pyobject': False, # Release GIL inside the native function 'release_gil': False, 'no_compile': False, 'debuginfo': False, 'boundcheck': False, 'forceinline': False, 'no_cpython_wrapper': False, # Enable automatic parallel optimization, can be fine-tuned by taking # a dictionary of sub-options instead of a boolean, see parfor.py for # detail. 'auto_parallel': cpu.ParallelOptions(False), 'nrt': False, 'no_rewrites': False, 'error_model': 'python', 'fastmath': cpu.FastMathOptions(False), 'noalias': False, 'inline': cpu.InlineOptions('never'), }
def autogenerate(cls): test_flags = [ 'fastmath', ] # TODO: add 'auto_parallel' ? # generate all the combinations of the flags test_flags = sum([list(combinations(test_flags, x)) for x in range( \ len(test_flags)+1)], []) flag_list = [] # create Flag class instances for ft in test_flags: flags = Flags() flags.set('nrt') flags.set('error_model', 'numpy') flags.__name__ = '_'.join(ft + ('usecase', )) for f in ft: flags.set(f, {'fastmath': cpu.FastMathOptions(True)}.get(f, True)) flag_list.append(flags) # main loop covering all the modes and use-cases for dtype in ( 'complex64', 'float64', 'float32', 'int32', ): for vlen in vlen2cpu: for flags in flag_list: for mode in "scalar", "range", "prange", "numpy": cls._inject_test(dtype, mode, vlen, flags) # mark important for n in ( "test_int32_range4_usecase", # issue #3016 ): setattr(cls, n, tag("important")(getattr(cls, n)))
def __init__(self, *args): self.flags = Flags() self.flags.set('nrt') # flags for njit(fastmath=True) self.fastflags = Flags() self.fastflags.set('nrt') self.fastflags.set('fastmath', cpu.FastMathOptions(True)) super(TestSVML, self).__init__(*args)
def compile_parallel(self, func, arg_types): fast_pflags = Flags() fast_pflags.set('auto_parallel', cpu.ParallelOptions(True)) fast_pflags.set('nrt') fast_pflags.set('fastmath', cpu.FastMathOptions(True)) return compile_isolated(func, arg_types, flags=fast_pflags).entry_point