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

Commit 0e61489

Browse files
author
Ehsan Totoni
committed
fix str dropna()
1 parent c548b71 commit 0e61489

5 files changed

Lines changed: 24 additions & 37 deletions

File tree

hpat/distributed_analysis.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -600,6 +600,9 @@ def _analyze_call_hpat_dist(self, lhs, func_name, args, array_dists):
600600
"""analyze distributions of hpat distributed functions
601601
(hpat.distributed_api.func_name)
602602
"""
603+
if func_name == 'parallel_print':
604+
return
605+
603606
if func_name == 'dist_return':
604607
arr_name = args[0].name
605608
assert arr_name in array_dists, "array distribution not found"

hpat/distributed_api.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -459,6 +459,11 @@ def generic(self, args, kws):
459459
return signature(args[0], *args)
460460

461461

462+
@numba.njit
463+
def parallel_print(s):
464+
print(s)
465+
466+
462467
def irecv(): # pragma: no cover
463468
return 0
464469

hpat/f.py

Lines changed: 0 additions & 37 deletions
This file was deleted.

hpat/str_arr_ext.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,10 @@ def codegen(context, builder, sig, args):
309309
builder.store(in_val, builder.gep(out_string_array.offsets, [curr_offset]))
310310
builder.store(builder.add(curr_offset, lir.Constant(context.get_data_type(offset_typ), 1)), curr_offset_ptr)
311311

312+
# set last offset
313+
curr_offset = builder.load(curr_offset_ptr)
314+
in_val = builder.load(builder.gep(in_string_array.offsets, [n]))
315+
builder.store(in_val, builder.gep(out_string_array.offsets, [curr_offset]))
312316
return context.get_dummy_value()
313317

314318
return types.void(string_array_type, string_array_type), codegen

hpat/tests/test_series.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -652,6 +652,18 @@ def test_impl(A):
652652
hpat_func = hpat.jit(test_impl)
653653
np.testing.assert_array_equal(hpat_func(S1), test_impl(S2))
654654

655+
@unittest.skip("TODO: fix result")
656+
def test_series_dropna_str_parallel1(self):
657+
def test_impl(A):
658+
B = A.dropna()
659+
return (B == 'gg').sum()
660+
661+
S1 = pd.Series(['aa', 'b', None, 'ccc', 'dd', 'gg'])
662+
hpat_func = hpat.jit(distributed=['A'])(test_impl)
663+
start, end = get_start_end(len(S1))
664+
# TODO: gatherv
665+
self.assertEqual(hpat_func(S1[start:end]), test_impl(S1))
666+
655667
def test_series_dropna_float_inplace1(self):
656668
def test_impl(A):
657669
A.dropna(inplace=True)

0 commit comments

Comments
 (0)