test_gpu_block_size_limiting.py 757 Bytes
Newer Older
1
from lbmpy.creationfunctions import create_lb_ast
2
import pytest
3
4
5


def test_gpu_block_size_limiting():
6
    pytest.importorskip("pycuda")
7
8
    too_large = 2048*2048
    opt = {'target': 'gpu', 'gpu_indexing_params': {'block_size': (too_large, too_large, too_large)}}
9
    ast = create_lb_ast(method='cumulant', stencil='D3Q19', relaxation_rate=1.8, optimization=opt,
10
                        compressible=True, force_model='guo')
11
12
13
14
15
16
    limited_block_size = ast.indexing.call_parameters((1024, 1024, 1024))
    kernel = ast.compile()
    assert all(b < too_large for b in limited_block_size['block'])
    bs = [too_large, too_large, too_large]
    ast.indexing.limit_block_size_by_register_restriction(bs, kernel.num_regs)
    assert all(b < too_large for b in bs)