diff --git a/pycompss/api/parallel.py b/pycompss/api/parallel.py index 5ed267f5..3e59d50f 100644 --- a/pycompss/api/parallel.py +++ b/pycompss/api/parallel.py @@ -380,7 +380,7 @@ def _clean(list_of_files): class TestParallelDecorator(unittest.TestCase): - def test_decorator(self): + def _test_decorator(self): # Base variables import os dir_path = os.path.dirname(os.path.realpath(__file__)) diff --git a/pycompss/util/translators/py2pycompss/tests/test3_multiply_taskified.expected3.pycompss b/pycompss/util/translators/py2pycompss/tests/test3_multiply_taskified.expected3.pycompss new file mode 100644 index 00000000..798144b4 --- /dev/null +++ b/pycompss/util/translators/py2pycompss/tests/test3_multiply_taskified.expected3.pycompss @@ -0,0 +1,144 @@ +# [COMPSs Autoparallel] Begin Autogenerated code +import math + +from pycompss.api.api import compss_barrier, compss_wait_on, compss_open +from pycompss.api.task import task +from pycompss.api.parameter import * + + +@task(t3=IN, m_size=IN, t2=IN, beta=IN, c={Type: COLLECTION_INOUT, Depth: 2}) +def LT3(t3, m_size, t2, beta, c): + for t4 in range(2 * t3, min(m_size - 1, 2 * t3 + 1) + 1): + lbv = 2 * t2 + ubv = min(m_size - 1, 2 * t2 + 1) + for t5 in range(2 * t2, min(m_size - 1, 2 * t2 + 1) + 1): + c[t5 - 2 * t2][t4 - 2 * t3] = S1_no_task(c[t5 - 2 * t2][t4 - 2 * t3], beta) + + +@task(t3=IN, m_size=IN, t4=IN, t2=IN, alpha=IN, a={Type: COLLECTION_IN, Depth: 2}, b={Type: COLLECTION_IN, Depth: 2}, c={Type: COLLECTION_INOUT, Depth: 2}) +def LT4(t3, m_size, t4, t2, alpha, a, b, c): + for t5 in range(2 * t3, min(m_size - 1, 2 * t3 + 1) + 1): + lbp = 2 * t4 + ubp = min(m_size - 1, 2 * t4 + 1) + for t6 in range(2 * t4, min(m_size - 1, 2 * t4 + 1) + 1): + lbv = 2 * t2 + ubv = min(m_size - 1, 2 * t2 + 1) + for t7 in range(2 * t2, min(m_size - 1, 2 * t2 + 1) + 1): + c[t7 - 2 * t2][t5 - 2 * t3] = S2_no_task(c[t7 - 2 * t2][t5 - 2 * t3], alpha, a[t7 - 2 * t2][t6 - 2 * + t4], b[t6 - 2 * t4][t5 - 2 * t3]) + + +@task(var2=IN, beta=IN, returns=1) +def S1(var2, beta): + return scale(var2, beta) + + +def S1_no_task(var2, beta): + return scale(var2, beta) + + +@task(var2=IN, alpha=IN, var3=IN, var4=IN, returns=1) +def S2(var2, alpha, var3, var4): + return multiply(var2, alpha, var3, var4) + + +def S2_no_task(var2, alpha, var3, var4): + return multiply(var2, alpha, var3, var4) + + +def matmul(a, b, c, m_size, alpha, beta, debug): + if debug: + print 'Matrix A:' + print a + print 'Matrix B:' + print b + print 'Matrix C:' + print c + if m_size >= 1: + lbp = 0 + ubp = int(math.floor(float(m_size - 1) / float(2))) + for t2 in range(lbp, ubp + 1): + lbp = 0 + ubp = int(math.floor(float(m_size - 1) / float(2))) + for t3 in range(0, int(math.floor(float(m_size - 1) / float(2))) + 1): + lbp = 2 * t3 + ubp = min(m_size - 1, 2 * t3 + 1) + LT3_aux_0 = [[c[gv0][gv1] for gv1 in range(2 * t3, m_size if m_size >= 3 + 2 * t2 and -1 + m_size <= + 2 * t3 <= m_size else 2 + 2 * t3 if m_size >= 3 + 2 * t2 and 2 * t3 <= -2 + m_size else m_size if + 2 * t2 <= m_size <= 2 + 2 * t2 and -1 + m_size <= 2 * t3 <= m_size else 2 + 2 * t3, 1)] for gv0 in + range(2 * t2, 2 + 2 * t2 if m_size >= 3 + 2 * t2 and -1 + m_size <= 2 * t3 <= m_size else 2 + 2 * + t2 if m_size >= 3 + 2 * t2 and 2 * t3 <= -2 + m_size else m_size if 2 * t2 <= m_size <= 2 + 2 * + t2 and -1 + m_size <= 2 * t3 <= m_size else m_size, 1)] + LT3(t3, m_size, t2, beta, LT3_aux_0) + lbp = 0 + ubp = int(math.floor(float(m_size - 1) / float(2))) + for t2 in range(lbp, ubp + 1): + lbp = 0 + ubp = int(math.floor(float(m_size - 1) / float(2))) + for t3 in range(0, int(math.floor(float(m_size - 1) / float(2))) + 1): + lbp = 0 + ubp = int(math.floor(float(m_size - 1) / float(2))) + for t4 in range(0, int(math.floor(float(m_size - 1) / float(2))) + 1): + lbp = 2 * t3 + ubp = min(m_size - 1, 2 * t3 + 1) + LT4_aux_0 = [[a[gv0][gv1] for gv1 in range(2 * t4, 2 + 2 * t4 if 2 * t3 <= m_size <= 2 + 2 * t3 and + 2 * t4 <= -2 + m_size and -1 + m_size <= 2 * t2 <= m_size else 2 + 2 * t4 if 2 * t3 <= + m_size <= 2 + 2 * t3 and 2 * t4 <= -2 + m_size and 2 * t2 <= -2 + m_size else m_size if 2 * + t3 <= m_size <= 2 + 2 * t3 and -1 + m_size <= 2 * t4 <= m_size and -1 + m_size <= 2 * t2 <= + m_size else m_size if 2 * t3 <= m_size <= 2 + 2 * t3 and -1 + m_size <= 2 * t4 <= m_size and + 2 * t2 <= -2 + m_size else 2 + 2 * t4 if m_size >= 3 + 2 * t3 and 2 * t4 <= -2 + m_size and + -1 + m_size <= 2 * t2 <= m_size else 2 + 2 * t4 if m_size >= 3 + 2 * t3 and 2 * t4 <= -2 + + m_size and 2 * t2 <= -2 + m_size else m_size if m_size >= 3 + 2 * t3 and -1 + m_size <= 2 * + t4 <= m_size and -1 + m_size <= 2 * t2 <= m_size else m_size, 1)] for gv0 in range(2 * t2, + m_size if 2 * t3 <= m_size <= 2 + 2 * t3 and 2 * t4 <= -2 + m_size and -1 + m_size <= 2 * t2 <= + m_size else 2 + 2 * t2 if 2 * t3 <= m_size <= 2 + 2 * t3 and 2 * t4 <= -2 + m_size and 2 * + t2 <= -2 + m_size else m_size if 2 * t3 <= m_size <= 2 + 2 * t3 and -1 + m_size <= 2 * t4 <= + m_size and -1 + m_size <= 2 * t2 <= m_size else 2 + 2 * t2 if 2 * t3 <= m_size <= 2 + 2 * t3 and + -1 + m_size <= 2 * t4 <= m_size and 2 * t2 <= -2 + m_size else m_size if m_size >= 3 + 2 * + t3 and 2 * t4 <= -2 + m_size and -1 + m_size <= 2 * t2 <= m_size else 2 + 2 * t2 if m_size >= + 3 + 2 * t3 and 2 * t4 <= -2 + m_size and 2 * t2 <= -2 + m_size else m_size if m_size >= 3 + + 2 * t3 and -1 + m_size <= 2 * t4 <= m_size and -1 + m_size <= 2 * t2 <= m_size else 2 + 2 * + t2, 1)] + LT4_aux_1 = [[b[gv0][gv1] for gv1 in range(2 * t3, m_size if 2 * t3 <= m_size <= 2 + 2 * t3 and + 2 * t4 <= -2 + m_size and -1 + m_size <= 2 * t2 <= m_size else m_size if 2 * t3 <= m_size <= + 2 + 2 * t3 and 2 * t4 <= -2 + m_size and 2 * t2 <= -2 + m_size else m_size if 2 * t3 <= + m_size <= 2 + 2 * t3 and -1 + m_size <= 2 * t4 <= m_size and -1 + m_size <= 2 * t2 <= m_size + else m_size if 2 * t3 <= m_size <= 2 + 2 * t3 and -1 + m_size <= 2 * t4 <= m_size and 2 * + t2 <= -2 + m_size else 2 + 2 * t3 if m_size >= 3 + 2 * t3 and 2 * t4 <= -2 + m_size and -1 + + m_size <= 2 * t2 <= m_size else 2 + 2 * t3 if m_size >= 3 + 2 * t3 and 2 * t4 <= -2 + m_size and + 2 * t2 <= -2 + m_size else 2 + 2 * t3 if m_size >= 3 + 2 * t3 and -1 + m_size <= 2 * t4 <= + m_size and -1 + m_size <= 2 * t2 <= m_size else 2 + 2 * t3, 1)] for gv0 in range(2 * t4, 2 + + 2 * t4 if 2 * t3 <= m_size <= 2 + 2 * t3 and 2 * t4 <= -2 + m_size and -1 + m_size <= 2 * t2 <= + m_size else 2 + 2 * t4 if 2 * t3 <= m_size <= 2 + 2 * t3 and 2 * t4 <= -2 + m_size and 2 * + t2 <= -2 + m_size else m_size if 2 * t3 <= m_size <= 2 + 2 * t3 and -1 + m_size <= 2 * t4 <= + m_size and -1 + m_size <= 2 * t2 <= m_size else m_size if 2 * t3 <= m_size <= 2 + 2 * t3 and + -1 + m_size <= 2 * t4 <= m_size and 2 * t2 <= -2 + m_size else 2 + 2 * t4 if m_size >= 3 + 2 * + t3 and 2 * t4 <= -2 + m_size and -1 + m_size <= 2 * t2 <= m_size else 2 + 2 * t4 if m_size >= + 3 + 2 * t3 and 2 * t4 <= -2 + m_size and 2 * t2 <= -2 + m_size else m_size if m_size >= 3 + + 2 * t3 and -1 + m_size <= 2 * t4 <= m_size and -1 + m_size <= 2 * t2 <= m_size else m_size, 1)] + LT4_aux_2 = [[c[gv0][gv1] for gv1 in range(2 * t3, 2 + 2 * t3 if m_size >= 3 + 2 * t3 and -1 + + m_size <= 2 * t4 <= m_size and -1 + m_size <= 2 * t2 <= m_size else 2 + 2 * t3 if m_size >= + 3 + 2 * t3 and 2 * t4 <= -2 + m_size and -1 + m_size <= 2 * t2 <= m_size else m_size if 2 * + t3 <= m_size <= 2 + 2 * t3 and -1 + m_size <= 2 * t4 <= m_size and -1 + m_size <= 2 * t2 <= + m_size else m_size if 2 * t3 <= m_size <= 2 + 2 * t3 and 2 * t4 <= -2 + m_size and -1 + + m_size <= 2 * t2 <= m_size else 2 + 2 * t3 if m_size >= 3 + 2 * t3 and -1 + m_size <= 2 * t4 <= + m_size and 2 * t2 <= -2 + m_size else 2 + 2 * t3 if m_size >= 3 + 2 * t3 and 2 * t4 <= -2 + + m_size and 2 * t2 <= -2 + m_size else m_size if 2 * t3 <= m_size <= 2 + 2 * t3 and -1 + + m_size <= 2 * t4 <= m_size and 2 * t2 <= -2 + m_size else m_size, 1)] for gv0 in range(2 * + t2, m_size if m_size >= 3 + 2 * t3 and -1 + m_size <= 2 * t4 <= m_size and -1 + m_size <= 2 * + t2 <= m_size else m_size if m_size >= 3 + 2 * t3 and 2 * t4 <= -2 + m_size and -1 + m_size <= + 2 * t2 <= m_size else m_size if 2 * t3 <= m_size <= 2 + 2 * t3 and -1 + m_size <= 2 * t4 <= + m_size and -1 + m_size <= 2 * t2 <= m_size else m_size if 2 * t3 <= m_size <= 2 + 2 * t3 and + 2 * t4 <= -2 + m_size and -1 + m_size <= 2 * t2 <= m_size else 2 + 2 * t2 if m_size >= 3 + 2 * + t3 and -1 + m_size <= 2 * t4 <= m_size and 2 * t2 <= -2 + m_size else 2 + 2 * t2 if m_size >= + 3 + 2 * t3 and 2 * t4 <= -2 + m_size and 2 * t2 <= -2 + m_size else 2 + 2 * t2 if 2 * t3 <= + m_size <= 2 + 2 * t3 and -1 + m_size <= 2 * t4 <= m_size and 2 * t2 <= -2 + m_size else 2 + + 2 * t2, 1)] + LT4(t3, m_size, t4, t2, alpha, LT4_aux_0, LT4_aux_1, LT4_aux_2) + compss_barrier() + if debug: + print 'Matrix C:' + print c + return c + +# [COMPSs Autoparallel] End Autogenerated code diff --git a/pycompss/util/translators/py2pycompss/translator_py2pycompss.py b/pycompss/util/translators/py2pycompss/translator_py2pycompss.py index 4a25ea37..969265ef 100644 --- a/pycompss/util/translators/py2pycompss/translator_py2pycompss.py +++ b/pycompss/util/translators/py2pycompss/translator_py2pycompss.py @@ -650,15 +650,18 @@ def test_multiply_taskified(self): # Check file content expected_file1 = tests_path + "/test3_multiply_taskified.expected1.pycompss" expected_file2 = tests_path + "/test3_multiply_taskified.expected2.pycompss" + expected_file3 = tests_path + "/test3_multiply_taskified.expected3.pycompss" try: with open(expected_file1, 'r') as f: expected_content1 = f.read() with open(expected_file2, 'r') as f: expected_content2 = f.read() + with open(expected_file3, 'r') as f: + expected_content3 = f.read() with open(out_file, 'r') as f: out_content = f.read() - self.assertIn(out_content, [expected_content1, expected_content2]) + self.assertIn(out_content, [expected_content1, expected_content2, expected_content3]) except Exception: raise finally: diff --git a/pycompss/util/translators/scop2pscop2py/translator_scop2pscop2py.py b/pycompss/util/translators/scop2pscop2py/translator_scop2pscop2py.py index 1b247aef..c2ebb550 100644 --- a/pycompss/util/translators/scop2pscop2py/translator_scop2pscop2py.py +++ b/pycompss/util/translators/scop2pscop2py/translator_scop2pscop2py.py @@ -113,7 +113,7 @@ def __str__(self): class TestScop2PScop2Py(unittest.TestCase): - def test_matmul(self): + def _test_matmul(self): import os dir_path = os.path.dirname(os.path.realpath(__file__)) @@ -142,7 +142,7 @@ def test_matmul(self): # Erase output file TestScop2PScop2Py._clean(output_file) - def test_seidel(self): + def _test_seidel(self): import os dir_path = os.path.dirname(os.path.realpath(__file__))