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

Commit 93c1f13

Browse files
Merge pull request #892 from Rubtsowa/remove_old_pipeline_config
remove skip_sdc_jit
2 parents d46fd3d + adba47f commit 93c1f13

21 files changed

Lines changed: 338 additions & 983 deletions

sdc/__init__.py

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -51,27 +51,25 @@
5151

5252
from ._version import get_versions
5353

54-
if not sdc.config.config_pipeline_hpat_default:
55-
"""
56-
Overload Numba function to allow call SDC pass in Numba compiler pipeline
57-
Functions are:
58-
- Numba DefaultPassBuilder define_nopython_pipeline()
59-
60-
TODO: Needs to detect 'import Pandas' and align initialization according to it
61-
"""
62-
63-
# sdc.config.numba_compiler_define_nopython_pipeline_orig = \
64-
# numba.core.compiler.DefaultPassBuilder.define_nopython_pipeline
65-
# numba.core.compiler.DefaultPassBuilder.define_nopython_pipeline = \
66-
# sdc.datatypes.hpat_pandas_dataframe_pass.sdc_nopython_pipeline_lite_register
67-
68-
import sdc.rewrites.dataframe_constructor
69-
import sdc.rewrites.read_csv_consts
70-
import sdc.rewrites.dataframe_getitem_attribute
71-
import sdc.datatypes.hpat_pandas_functions
72-
import sdc.datatypes.hpat_pandas_dataframe_functions
73-
else:
74-
import sdc.compiler
54+
"""
55+
Overload Numba function to allow call SDC pass in Numba compiler pipeline
56+
Functions are:
57+
- Numba DefaultPassBuilder define_nopython_pipeline()
58+
59+
TODO: Needs to detect 'import Pandas' and align initialization according to it
60+
"""
61+
62+
# sdc.config.numba_compiler_define_nopython_pipeline_orig = \
63+
# numba.core.compiler.DefaultPassBuilder.define_nopython_pipeline
64+
# numba.core.compiler.DefaultPassBuilder.define_nopython_pipeline = \
65+
# sdc.datatypes.hpat_pandas_dataframe_pass.sdc_nopython_pipeline_lite_register
66+
67+
import sdc.rewrites.dataframe_constructor
68+
import sdc.rewrites.read_csv_consts
69+
import sdc.rewrites.dataframe_getitem_attribute
70+
import sdc.datatypes.hpat_pandas_functions
71+
import sdc.datatypes.hpat_pandas_dataframe_functions
72+
7573

7674
multithread_mode = False
7775

sdc/config.py

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,6 @@ def strtobool(val):
5656
because decorator called later then modules have been initialized
5757
'''
5858

59-
config_pipeline_hpat_default = strtobool(os.getenv('SDC_CONFIG_PIPELINE_SDC', 'False'))
60-
'''
61-
Default value used to select compiler pipeline in a function decorator
62-
'''
63-
6459
config_use_parallel_overloads = strtobool(os.getenv('SDC_AUTO_PARALLEL', 'True'))
6560
'''
6661
Default value used to select whether auto parallel would be applied to sdc functions
@@ -71,16 +66,6 @@ def strtobool(val):
7166
Default value used to select whether sdc functions would inline
7267
'''
7368

74-
if not config_pipeline_hpat_default:
75-
# avoid using MPI transport if no SDC compiler pipeline used
76-
config_transport_mpi_default = False
77-
config_transport_mpi = config_transport_mpi_default
78-
79-
numba_compiler_define_nopython_pipeline_orig = None
80-
'''
81-
Default value for a pointer intended to use as Numba.DefaultPassBuilder.define_nopython_pipeline() in overloaded function
82-
'''
83-
8469
test_expected_failure = strtobool(os.getenv('SDC_TEST_EXPECTED_FAILURE', 'False'))
8570
'''
8671
If True then replaces skip decorators to expectedFailure decorator.

sdc/datatypes/hpat_pandas_dataframe_types.py

Lines changed: 63 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,6 @@
4141
from numba.core.datamodel import register_default, StructModel
4242
from numba.core.typing.templates import signature, infer_global, AbstractTemplate
4343

44-
from sdc.config import config_pipeline_hpat_default
45-
4644

4745
class DataFrameTypeIterator(types.SimpleIteratorType):
4846
"""
@@ -111,23 +109,23 @@ def iterator_type(self):
111109
return DataFrameTypeIterator(self)
112110

113111

114-
if not config_pipeline_hpat_default:
115-
@register_model(DataFrameType)
116-
class DataFrameTypeModel(StructModel):
117-
"""
118-
Model for DataFrameType type
119-
All members must be the same as main type for this model
112+
@register_model(DataFrameType)
113+
class DataFrameTypeModel(StructModel):
114+
"""
115+
Model for DataFrameType type
116+
All members must be the same as main type for this model
120117
121-
Test: python -m sdc.runtests sdc.tests.test_dataframe.TestDataFrame.test_create_numeric_column
122-
"""
118+
Test: python -m sdc.runtests sdc.tests.test_dataframe.TestDataFrame.test_create_numeric_column
119+
"""
120+
121+
def __init__(self, dmm, fe_type):
122+
members = [
123+
('data', fe_type.data)
124+
]
125+
models.StructModel.__init__(self, dmm, fe_type, members)
123126

124-
def __init__(self, dmm, fe_type):
125-
members = [
126-
('data', fe_type.data)
127-
]
128-
models.StructModel.__init__(self, dmm, fe_type, members)
129127

130-
make_attribute_wrapper(DataFrameType, 'data', '_data')
128+
make_attribute_wrapper(DataFrameType, 'data', '_data')
131129

132130

133131
@intrinsic
@@ -164,65 +162,65 @@ def _hpat_pandas_dataframe_init_codegen(context, builder, signature, args):
164162
return sig, _hpat_pandas_dataframe_init_codegen
165163

166164

167-
if not config_pipeline_hpat_default:
168-
@overload(pandas.DataFrame)
169-
def hpat_pandas_dataframe(data=None, index=None, columns=None, dtype=None, copy=False):
170-
"""
171-
Special Numba procedure to overload Python type pandas.DataFrame::ctor() with Numba registered model
172-
"""
165+
@overload(pandas.DataFrame)
166+
def hpat_pandas_dataframe(data=None, index=None, columns=None, dtype=None, copy=False):
167+
"""
168+
Special Numba procedure to overload Python type pandas.DataFrame::ctor() with Numba registered model
169+
"""
173170

174-
if isinstance(data, types.DictType):
175-
def hpat_pandas_dataframe_impl(data=None, index=None, columns=None, dtype=None, copy=False):
176-
series_dict = {}
177-
series_list = []
171+
if isinstance(data, types.DictType):
172+
def hpat_pandas_dataframe_impl(data=None, index=None, columns=None, dtype=None, copy=False):
173+
series_dict = {}
174+
series_list = []
178175

179-
for key, value in data.items():
180-
"""
181-
Convert input dictionary with:
182-
key - unicode string
183-
value - array
184-
into dictinary of pandas.Series with same names and values
185-
"""
176+
for key, value in data.items():
177+
"""
178+
Convert input dictionary with:
179+
key - unicode string
180+
value - array
181+
into dictinary of pandas.Series with same names and values
182+
"""
186183

187-
series_item = pandas.Series(data=value, name=key)
188-
series_dict[key] = series_item
189-
series_list.append(series_item)
184+
series_item = pandas.Series(data=value, name=key)
185+
series_dict[key] = series_item
186+
series_list.append(series_item)
190187

191-
# return _hpat_pandas_dataframe_init(series_dict)
192-
return _hpat_pandas_dataframe_init(series_list)
188+
# return _hpat_pandas_dataframe_init(series_dict)
189+
return _hpat_pandas_dataframe_init(series_list)
193190

194-
return hpat_pandas_dataframe_impl
191+
return hpat_pandas_dataframe_impl
195192

196-
@box(DataFrameType)
197-
def hpat_pandas_dataframe_box(typ, val, c):
198-
"""
199-
This method is to copy data from JITted region data structure
200-
to new Python object data structure.
201-
Python object data structure has creating in this procedure.
202-
"""
203193

204-
dataframe = cgutils.create_struct_proxy(typ)(c.context, c.builder, value=val)
194+
@box(DataFrameType)
195+
def hpat_pandas_dataframe_box(typ, val, c):
196+
"""
197+
This method is to copy data from JITted region data structure
198+
to new Python object data structure.
199+
Python object data structure has creating in this procedure.
200+
"""
205201

206-
ir_ptr_data = c.box(typ.data, dataframe.data)
202+
dataframe = cgutils.create_struct_proxy(typ)(c.context, c.builder, value=val)
207203

208-
dataframe_ctor_args = c.pyapi.tuple_pack([ir_ptr_data, ])
209-
# dataframe_ctor_kwargs = c.pyapi.dict_pack([("data", ir_ptr_data), ])
210-
"""
211-
It is better to use kwargs but it fails into SIGSEGV
212-
"""
204+
ir_ptr_data = c.box(typ.data, dataframe.data)
213205

214-
dataframe_ctor_fn = c.pyapi.unserialize(c.pyapi.serialize_object(pandas.DataFrame))
215-
"""
216-
Create a pandas.DataFrame ctor() function pointer
217-
"""
206+
dataframe_ctor_args = c.pyapi.tuple_pack([ir_ptr_data, ])
207+
# dataframe_ctor_kwargs = c.pyapi.dict_pack([("data", ir_ptr_data), ])
208+
"""
209+
It is better to use kwargs but it fails into SIGSEGV
210+
"""
218211

219-
df_obj = c.pyapi.call(dataframe_ctor_fn, dataframe_ctor_args) # kws=dataframe_ctor_kwargs)
220-
"""
221-
Call pandas.DataFrame function pointer with parameters
222-
"""
212+
dataframe_ctor_fn = c.pyapi.unserialize(c.pyapi.serialize_object(pandas.DataFrame))
213+
"""
214+
Create a pandas.DataFrame ctor() function pointer
215+
"""
216+
217+
df_obj = c.pyapi.call(dataframe_ctor_fn, dataframe_ctor_args) # kws=dataframe_ctor_kwargs)
218+
"""
219+
Call pandas.DataFrame function pointer with parameters
220+
"""
223221

224-
c.pyapi.decref(ir_ptr_data)
225-
c.pyapi.decref(dataframe_ctor_args)
226-
c.pyapi.decref(dataframe_ctor_fn)
222+
c.pyapi.decref(ir_ptr_data)
223+
c.pyapi.decref(dataframe_ctor_args)
224+
c.pyapi.decref(dataframe_ctor_fn)
227225

228-
return df_obj
226+
return df_obj

sdc/decorators.py

Lines changed: 4 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -40,44 +40,7 @@ def jit(signature_or_function=None, **options):
4040
'''
4141
options['nopython'] = True
4242

43-
if not sdc.config.config_pipeline_hpat_default:
44-
'''
45-
Use Numba compiler pipeline
46-
'''
47-
return numba.jit(signature_or_function, **options)
48-
49-
_locals = options.pop('locals', {})
50-
assert isinstance(_locals, dict)
51-
52-
# put pivots in locals TODO: generalize numba.jit options
53-
pivots = options.pop('pivots', {})
54-
assert isinstance(pivots, dict)
55-
for var, vals in pivots.items():
56-
_locals[var + ":pivot"] = vals
57-
58-
distributed = set(options.pop('distributed', set()))
59-
assert isinstance(distributed, (set, list))
60-
_locals["##distributed"] = distributed
61-
62-
threaded = set(options.pop('threaded', set()))
63-
assert isinstance(threaded, (set, list))
64-
_locals["##threaded"] = threaded
65-
66-
options['locals'] = _locals
67-
68-
#options['parallel'] = True
69-
options['parallel'] = {'comprehension': True,
70-
'setitem': False, # FIXME: support parallel setitem
71-
'reduction': True,
72-
'numpy': True,
73-
'stencil': True,
74-
'fusion': True,
75-
}
76-
77-
# Option MPI is boolean and true by default
78-
# it means MPI transport will be used
79-
mpi_transport_requested = options.pop('MPI', sdc.config.config_transport_mpi_default)
80-
if not isinstance(mpi_transport_requested, (int, bool)):
81-
raise ValueError("Option MPI or SDC_CONFIG_MPI environment variable should be boolean")
82-
83-
return numba.jit(signature_or_function, pipeline_class=sdc.compiler.SDCPipeline, **options)
43+
'''
44+
Use Numba compiler pipeline
45+
'''
46+
return numba.jit(signature_or_function, **options)

sdc/distributed_lower.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -620,9 +620,3 @@ def lower_hpat_finalize(context, builder, sig, args):
620620
@numba.njit
621621
def call_finalize():
622622
hpat_finalize()
623-
624-
625-
if sdc.config.config_pipeline_hpat_default:
626-
atexit.register(call_finalize)
627-
# flush output before finalize
628-
atexit.register(sys.stdout.flush)

0 commit comments

Comments
 (0)