pytest.mark.perf

Here are the examples of the python api pytest.mark.perf taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

11 Examples 7

Example 1

Project: reikna Source File: test_reduce.py
Function: test_summation
@pytest.mark.perf
@pytest.mark.returns('GB/s')
def test_summation(thr):

    perf_size = 2 ** 22
    dtype = dtypes.normalize_type(numpy.int64)

    a = get_test_array(perf_size, dtype)
    a_dev = thr.to_device(a)

    rd = Reduce(a, predicate_sum(dtype))

    b_dev = thr.empty_like(rd.parameter.output)
    b_ref = numpy.array([a.sum()], dtype)

    rdc = rd.compile(thr)

    attempts = 10
    times = []
    for i in range(attempts):
        t1 = time.time()
        rdc(b_dev, a_dev)
        thr.synchronize()
        times.append(time.time() - t1)

    assert diff_is_negligible(b_dev.get(), b_ref)

    return min(times), perf_size * dtype.itemsize

Example 2

Project: reikna Source File: test_cbrng.py
@pytest.mark.perf
@pytest.mark.returns('GB/s')
def test_computation_performance(thr_and_double, fast_math, test_sampler_float):

    thr, double = thr_and_double

    size = 2 ** 15
    batch = 2 ** 6

    bijection = philox(64, 4)
    sampler = test_sampler_float.get_sampler(bijection, double)

    rng = CBRNG(Type(sampler.dtype, shape=(batch, size)), 1, sampler)

    dest_dev = thr.empty_like(rng.parameter.randoms)
    counters = rng.create_counters()
    counters_dev = thr.to_device(counters)
    rngc = rng.compile(thr, fast_math=fast_math)

    attempts = 10
    times = []
    for i in range(attempts):
        t1 = time.time()
        rngc(counters_dev, dest_dev)
        thr.synchronize()
        times.append(time.time() - t1)

    byte_size = size * batch * sampler.dtype.itemsize
    return min(times), byte_size

Example 3

Project: reikna Source File: test_fft.py
@pytest.mark.perf
@pytest.mark.returns('GFLOPS')
def test_power_of_2_performance(thr_and_double, perf_shape_and_axes, fast_math):
    return check_performance(thr_and_double, perf_shape_and_axes, fast_math)

Example 4

Project: reikna Source File: test_fft.py
@pytest.mark.perf
@pytest.mark.returns('GFLOPS')
def test_non_power_of_2_performance(thr_and_double, non2problem_perf_shape_and_axes, fast_math):
    return check_performance(thr_and_double, non2problem_perf_shape_and_axes, fast_math)

Example 5

Project: reikna Source File: test_fftshift.py
@pytest.mark.perf
@pytest.mark.returns('GB/s')
def test_even_performance(thr_and_double, perf_even_shape_and_axes):
    return check_performance(thr_and_double, perf_even_shape_and_axes)

Example 6

Project: reikna Source File: test_fftshift.py
@pytest.mark.perf
@pytest.mark.returns('GB/s')
def test_odd_performance(thr_and_double, perf_odd_shape_and_axes):
    return check_performance(thr_and_double, perf_odd_shape_and_axes)

Example 7

Project: reikna Source File: test_matrixmul.py
@pytest.mark.perf
@pytest.mark.returns('GFLOPS')
def test_performance_shape(thr_and_double, perf_shape, transposed_a, transposed_b):
    return check_performance(thr_and_double, perf_shape,
        transposed_a=transposed_a, transposed_b=transposed_b)

Example 8

Project: reikna Source File: test_matrixmul.py
@pytest.mark.perf
@pytest.mark.returns('GFLOPS')
def test_performance_block_width(thr_and_double, perf_bwo):
    return check_performance(thr_and_double, (4, 512), bwo=perf_bwo)

Example 9

Project: HdrHistogram_py Source File: test_hdrhistogram.py
@pytest.mark.perf
def test_cod_perf():
    cProfile.runctx('check_cod_perf()', globals(), locals())

Example 10

Project: HdrHistogram_py Source File: test_hdrhistogram.py
@pytest.mark.perf
def test_dec_perf():
    cProfile.runctx('check_dec_perf()', globals(), locals())

Example 11

Project: integration_tests Source File: skipper.py
Function: pytest_collection_modifyitems
def pytest_collection_modifyitems(items):
    # mark all perf tests here so we don't have to maintain the mark in those modules
    for item in items:
        if item.nodeid.startswith('cfme/tests/perf'):
            item.add_marker(pytest.mark.perf)