Beispiel #1
0
def test_get_features_multiple_kernels():
    code = """\
__kernel void A(__global float* a) {}
__kernel void B(__global float* a) {}"""

    with pytest.raises(clgen.FeaturesError):
        clgen.get_kernel_features(code)
Beispiel #2
0
def test_get_features_bad_code():
    code = """\
__kernel void A(__global float* a) {
  SYNTAX ERROR!
}"""
    with tests.DevNullRedirect():
        with pytest.raises(clgen.FeaturesError):
            clgen.get_kernel_features(code, quiet=True)
Beispiel #3
0
def test_get_features():
    code = """\
__kernel void A(__global float* a) {
  int b = get_global_id(0);
  a[b] *= 2.0f;
}"""
    assert np.array_equal(clgen.get_kernel_features(code),
                          [0, 0, 1, 0, 1, 0, 1, 0])