def test_ompss_call(): context.set_pycompss_context(context.MASTER) my_ompss = OmpSs(binary="date") f = my_ompss(dummy_function) result = f() context.set_pycompss_context(context.OUT_OF_SCOPE) assert result == 1, "Wrong expected result (should be 1)."
def test_ompss_existing_core_element(): context.set_pycompss_context(context.MASTER) my_ompss = OmpSs(binary="date") f = my_ompss(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_ompss.kwargs, \ "Core Element is not defined in kwargs dictionary."
def test_ompss_call_outside(): context.set_pycompss_context(context.OUT_OF_SCOPE) my_ompss = OmpSs(binary="date") f = my_ompss(dummy_function) thrown = False try: _ = f() except Exception: # noqa thrown = True # this is OK! assert thrown, \ "The ompss decorator did not raise an exception when invoked out of scope." # noqa: E501
def test_ompss_instantiation(): context.set_pycompss_context(context.MASTER) my_ompss = OmpSs(binary="date") assert (my_ompss.decorator_name == "@ompss" ), "The decorator name must be @ompss."