Beispiel #1
0
 def test_mangled_flags_with_fastmath_parfors_inline(self):
     # at least for these control cases
     flags = Flags()
     flags.nrt = True
     flags.auto_parallel = True
     flags.fastmath = True
     flags.inline = "always"
     self.assertLess(len(flags.get_mangle_string()), len(flags.summary()))
     demangled = flags.demangle(flags.get_mangle_string())
     # There should be no pointer value in the demangled string.
     self.assertNotIn("0x", demangled)
Beispiel #2
0
 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
Beispiel #3
0
 def test_mangled_flags_is_shorter(self):
     # at least for these control cases
     flags = Flags()
     flags.nrt = True
     flags.auto_parallel = True
     self.assertLess(len(flags.get_mangle_string()), len(flags.summary()))
Beispiel #4
0
    return obj.h


def unsupported_parfor(a, b):
    return np.dot(a, b)  # dot as gemm unsupported


def supported_parfor(n):
    a = np.ones(n)
    for i in prange(n):
        a[i] = a[i] + np.sin(i)
    return a


force_parallel_flags = Flags()
force_parallel_flags.auto_parallel = ParallelOptions(True)
force_parallel_flags.nrt = True


class DebugTestBase(TestCase):

    all_dumps = set([
        'bytecode', 'cfg', 'ir', 'typeinfer', 'llvm', 'func_opt_llvm',
        'optimized_llvm', 'assembly'
    ])

    def assert_fails(self, *args, **kwargs):
        self.assertRaises(AssertionError, *args, **kwargs)

    def check_debug_output(self, out, dump_names):
        enabled_dumps = dict.fromkeys(self.all_dumps, False)