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, # Enable SSA: 'enable_ssa': True, # Force pyobject mode inside the whole function 'force_pyobject': False, # Release GIL inside the native function 'release_gil': False, 'no_compile': False, 'debuginfo': False, 'boundscheck': False, 'forceinline': False, 'no_cpython_wrapper': False, 'no_cfunc_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.nrt = True # flags for njit(fastmath=True) self.fastflags = Flags() self.fastflags.nrt = True self.fastflags.fastmath = cpu.FastMathOptions(True) super(TestSVML, self).__init__(*args)
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
def compile_parallel(self, func, arg_types): fast_pflags = Flags() fast_pflags.auto_parallel = cpu.ParallelOptions(True) fast_pflags.nrt = True fast_pflags.fastmath = cpu.FastMathOptions(True) return compile_isolated(func, arg_types, flags=fast_pflags).entry_point
class Flags(TargetConfig): enable_looplift = Option( type=bool, default=False, doc="Enable loop-lifting", ) enable_pyobject = Option( type=bool, default=False, doc="Enable pyobject mode (in general)", ) enable_pyobject_looplift = Option( type=bool, default=False, doc="Enable pyobject mode inside lifted loops", ) enable_ssa = Option( type=bool, default=True, doc="Enable SSA", ) force_pyobject = Option( type=bool, default=False, doc="Force pyobject mode inside the whole function", ) release_gil = Option( type=bool, default=False, doc="Release GIL inside the native function", ) no_compile = Option( type=bool, default=False, doc="TODO", ) debuginfo = Option( type=bool, default=False, doc="TODO", ) boundscheck = Option( type=bool, default=False, doc="TODO", ) forceinline = Option( type=bool, default=False, doc="Force inlining of the function. Overrides _dbg_optnone.", ) no_cpython_wrapper = Option( type=bool, default=False, doc="TODO", ) no_cfunc_wrapper = Option( type=bool, default=False, doc="TODO", ) auto_parallel = Option( type=cpu.ParallelOptions, default=cpu.ParallelOptions(False), doc="""Enable automatic parallel optimization, can be fine-tuned by taking a dictionary of sub-options instead of a boolean, see parfor.py for detail""", ) nrt = Option( type=bool, default=False, doc="TODO", ) no_rewrites = Option( type=bool, default=False, doc="TODO", ) error_model = Option( type=str, default="python", doc="TODO", ) fastmath = Option( type=cpu.FastMathOptions, default=cpu.FastMathOptions(False), doc="TODO", ) noalias = Option( type=bool, default=False, doc="TODO", ) inline = Option( type=cpu.InlineOptions, default=cpu.InlineOptions("never"), doc="TODO", ) # Defines a new target option for tracking the "target backend". # This will be the XYZ in @jit(_target=XYZ). target_backend = Option( type=str, default="cpu", # if not set, default to CPU doc="backend") dbg_extend_lifetimes = Option( type=bool, default=False, doc=("Extend variable lifetime for debugging. " "This automatically turns on with debug=True."), ) dbg_optnone = Option( type=bool, default=False, doc=("Disable optimization for debug. " "Equivalent to adding optnone attribute in the LLVM Function."))
class Flags(TargetConfig): enable_looplift = Option( type=bool, default=False, doc="Enable loop-lifting", ) enable_pyobject = Option( type=bool, default=False, doc="Enable pyobject mode (in general)", ) enable_pyobject_looplift = Option( type=bool, default=False, doc="Enable pyobject mode inside lifted loops", ) enable_ssa = Option( type=bool, default=True, doc="Enable SSA", ) force_pyobject = Option( type=bool, default=False, doc="Force pyobject mode inside the whole function", ) release_gil = Option( type=bool, default=False, doc="Release GIL inside the native function", ) no_compile = Option( type=bool, default=False, doc="TODO", ) debuginfo = Option( type=bool, default=False, doc="TODO", ) boundscheck = Option( type=bool, default=False, doc="TODO", ) forceinline = Option( type=bool, default=False, doc="TODO", ) no_cpython_wrapper = Option( type=bool, default=False, doc="TODO", ) no_cfunc_wrapper = Option( type=bool, default=False, doc="TODO", ) auto_parallel = Option( type=cpu.ParallelOptions, default=cpu.ParallelOptions(False), doc="""Enable automatic parallel optimization, can be fine-tuned by taking a dictionary of sub-options instead of a boolean, see parfor.py for detail""", ) nrt = Option( type=bool, default=False, doc="TODO", ) no_rewrites = Option( type=bool, default=False, doc="TODO", ) error_model = Option( type=str, default="python", doc="TODO", ) fastmath = Option( type=cpu.FastMathOptions, default=cpu.FastMathOptions(False), doc="TODO", ) noalias = Option( type=bool, default=False, doc="TODO", ) inline = Option( type=cpu.InlineOptions, default=cpu.InlineOptions("never"), doc="TODO", )