Пример #1
0
def test_opencl_call():
    context.set_pycompss_context(context.MASTER)
    my_opencl = OpenCL(kernel="date")
    f = my_opencl(dummy_function)
    result = f()
    assert result == 1, \
        "Wrong expected result (should be 1)."
Пример #2
0
def test_opencl_instantiation():
    context.set_pycompss_context(context.MASTER)
    my_opencl = OpenCL(kernel="date")
    context.set_pycompss_context(context.OUT_OF_SCOPE)
    assert (
        my_opencl.decorator_name == "@opencl"
    ), "The decorator name must be @opencl."
Пример #3
0
def test_opencl_existing_core_element():
    context.set_pycompss_context(context.MASTER)
    my_opencl = OpenCL(kernel="date")
    f = my_opencl(dummy_function)
    # a higher level decorator would place the compss core element as follows:
    _ = f(compss_core_element=CE())
    assert CORE_ELEMENT_KEY not in my_opencl.kwargs, \
           "Core Element is not defined in kwargs dictionary."
Пример #4
0
def test_opencl_call_outside():
    context.set_pycompss_context(context.OUT_OF_SCOPE)
    my_opencl = OpenCL(kernel="date")
    f = my_opencl(dummy_function)
    thrown = False
    try:
        _ = f()
    except Exception:  # noqa
        thrown = True  # this is OK!
    assert thrown, \
        "The opencl decorator did not raise an exception when invoked out of scope."  # noqa: E501