Exemplo n.º 1
0
def test_moa_numba_reduce(benchmark):
    n = 1000
    m = 1000

    expression = LazyArray(name='A', shape=('n', 'm')).reduce('+')

    local_dict = {}
    exec(expression.compile(backend='python', use_numba=True), globals(),
         local_dict)

    A = numpy.random.random((n, m))

    benchmark(local_dict['f'], A)
Exemplo n.º 2
0
def test_moa_numba_outer_product(benchmark):
    n = 100
    m = 100

    expression = LazyArray(name='A', shape=('n', 'm')).outer(
        '*', LazyArray(name='B', shape=('n', 'm')))

    local_dict = {}
    exec(expression.compile(backend='python', use_numba=True), globals(),
         local_dict)

    A = numpy.random.random((n, m))
    B = numpy.random.random((n, m))

    benchmark(local_dict['f'], A, B)
Exemplo n.º 3
0
def test_moa_numba_double_addition(benchmark):
    n = 1000
    m = 1000

    expression = LazyArray(name='A', shape=('n', 'm')) + LazyArray(
        name='B', shape=('n', 'm')) + LazyArray(name='C', shape=('n', 'm'))

    local_dict = {}
    exec(expression.compile(backend='python', use_numba=True), globals(),
         local_dict)

    A = numpy.random.random((n, m))
    B = numpy.random.random((n, m))
    C = numpy.random.random((n, m))

    benchmark(local_dict['f'], A=A, B=B, C=C)