Skip to content
This repository was archived by the owner on Feb 2, 2024. It is now read-only.

Commit 43f658e

Browse files
authored
Fix bm parallel (#609)
* Add parallel=True to perf tests. * Remove _test_jitted() and _test_python from test_perf_numpy.py b/c it is in base class * Remove _test_jitted() and _test_python from test_perf_df_rolling.py * Order imports in sdc/tests/tests_perf/__init__.py * Remove _test_jitted() and _test_python from test_perf_read_csv.py
1 parent a9a0519 commit 43f658e

File tree

5 files changed

+11
-59
lines changed

5 files changed

+11
-59
lines changed

sdc/tests/tests_perf/__init__.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1+
from sdc.tests.tests_perf.test_perf_df import *
12
from sdc.tests.tests_perf.test_perf_df_rolling import *
2-
from sdc.tests.tests_perf.test_perf_series_rolling import *
3+
from sdc.tests.tests_perf.test_perf_numpy import *
4+
from sdc.tests.tests_perf.test_perf_read_csv import *
5+
from sdc.tests.tests_perf.test_perf_series import *
36
from sdc.tests.tests_perf.test_perf_series_operators import *
4-
from sdc.tests.tests_perf.test_perf_unicode import *
7+
from sdc.tests.tests_perf.test_perf_series_rolling import *
58
from sdc.tests.tests_perf.test_perf_series_str import *
6-
from sdc.tests.tests_perf.test_perf_series import *
7-
from sdc.tests.tests_perf.test_perf_df import *
8-
from sdc.tests.tests_perf.test_perf_numpy import *
9-
from . import test_perf_read_csv
9+
from sdc.tests.tests_perf.test_perf_unicode import *

sdc/tests/tests_perf/test_perf_base.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22
import unittest
33
import numba
44

5+
from sdc.tests.test_base import TestCase
56
from sdc.tests.tests_perf.test_perf_utils import *
67

78

8-
class TestBase(unittest.TestCase):
9+
class TestBase(TestCase):
910
iter_number = 5
1011
results_class = TestResults
1112

@@ -42,7 +43,7 @@ def _test_jitted(self, pyfunc, record, *args, **kwargs):
4243
# compilation time
4344
record["compile_results"] = calc_compilation(pyfunc, *args, **kwargs)
4445

45-
cfunc = numba.njit(pyfunc)
46+
cfunc = self.jit(pyfunc)
4647

4748
# execution and boxing time
4849
record["test_results"], record["boxing_results"] = \

sdc/tests/tests_perf/test_perf_df_rolling.py

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -101,20 +101,6 @@ def setUpClass(cls):
101101
'var': [2 * 10 ** 5],
102102
}
103103

104-
def _test_jitted(self, pyfunc, record, *args, **kwargs):
105-
# compilation time
106-
record['compile_results'] = calc_compilation(pyfunc, *args, **kwargs)
107-
108-
cfunc = numba.njit(pyfunc)
109-
110-
# execution and boxing time
111-
record['test_results'], record['boxing_results'] = get_times(cfunc,
112-
*args,
113-
**kwargs)
114-
115-
def _test_python(self, pyfunc, record, *args, **kwargs):
116-
record['test_results'], _ = get_times(pyfunc, *args, **kwargs)
117-
118104
def _gen_df(self, data, columns_num=10):
119105
"""Generate DataFrame based on input data"""
120106
return pandas.DataFrame({col: data for col in string.ascii_uppercase[:columns_num]})

sdc/tests/tests_perf/test_perf_numpy.py

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -48,20 +48,6 @@ class TestFunctions(TestBase):
4848
def setUpClass(cls):
4949
super().setUpClass()
5050

51-
def _test_jitted(self, pyfunc, record, *args, **kwargs):
52-
# compilation time
53-
record["compile_results"] = calc_compilation(pyfunc, *args, **kwargs)
54-
55-
sdc_func = sdc.jit(pyfunc)
56-
57-
# execution and boxing time
58-
record["test_results"], record["boxing_results"] = \
59-
get_times(sdc_func, *args, **kwargs)
60-
61-
def _test_python(self, pyfunc, record, *args, **kwargs):
62-
record["test_results"], _ = \
63-
get_times(pyfunc, *args, **kwargs)
64-
6551
def _test_case(self, cases, name, total_data_length, data_num=1, input_data=test_global_input_data_float64):
6652
test_name = '{}'.format(name)
6753

sdc/tests/tests_perf/test_perf_read_csv.py

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -66,35 +66,14 @@ def setUpClass(cls):
6666
cls.columns = 10
6767
cls.generated_file = generate_csv(cls.rows, cls.columns)
6868

69-
def _test_jitted(self, pyfunc, record, *args, **kwargs):
70-
# compilation time
71-
record["compile_results"] = calc_compilation(pyfunc, *args, **kwargs)
72-
73-
sdc_func = sdc.jit(pyfunc)
74-
75-
# execution and boxing time
76-
record["test_results"], record["boxing_results"] = \
77-
get_times(sdc_func, *args, **kwargs)
78-
79-
def _test_python(self, pyfunc, record, *args, **kwargs):
80-
record["test_results"], _ = \
81-
get_times(pyfunc, *args, **kwargs)
82-
8369
def _test_case(self, pyfunc, name):
8470
base = {
8571
"test_name": name,
8672
"data_size": f"[{self.rows},{self.columns}]",
8773
}
8874

89-
record = base.copy()
90-
record["test_type"] = 'SDC'
91-
self._test_jitted(pyfunc, record)
92-
self.test_results.add(**record)
93-
94-
record = base.copy()
95-
record["test_type"] = 'Python'
96-
self._test_python(pyfunc, record)
97-
self.test_results.add(**record)
75+
self._test_jit(pyfunc, base)
76+
self._test_py(pyfunc, base)
9877

9978
def test_read_csv(self):
10079
self._test_case(make_func(self.generated_file), 'read_csv')

0 commit comments

Comments
 (0)