Skip to content

Commit

Permalink
Cull profiler for now
Browse files Browse the repository at this point in the history
  • Loading branch information
wence- committed May 1, 2024
1 parent c45563b commit 7c2e8e6
Show file tree
Hide file tree
Showing 2 changed files with 403 additions and 599 deletions.
65 changes: 0 additions & 65 deletions python/cudf_polars/cudf_polars/patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,71 +96,6 @@ def collect_with_gpu(

return wrap_df(ldf.collect())

# TODO: docstring is not correct
@functools.wraps(pl.LazyFrame.profile)
def profile_with_gpu(
self,
*,
use_gpu: bool = use_gpu_default,
return_on_gpu: bool = False,
cpu_fallback: bool = cpu_fallback_default,
type_coercion: bool = True,
predicate_pushdown: bool = True,
projection_pushdown: bool = True,
simplify_expression: bool = True,
no_optimization: bool = False,
slice_pushdown: bool = True,
comm_subplan_elim: bool = True,
comm_subexpr_elim: bool = True,
show_plot: bool = False,
truncate_nodes: int = 0,
figsize: tuple[int, int] = (18, 8),
streaming: bool = False,
):
if streaming:
use_gpu = False
if no_optimization:
predicate_pushdown = False
projection_pushdown = False
comm_subplan_elim = False
comm_subexpr_elim = False

ldf = self._ldf.optimization_toggle(
type_coercion,
predicate_pushdown,
projection_pushdown,
simplify_expression,
slice_pushdown,
comm_subplan_elim,
comm_subexpr_elim,
streaming,
_eager=False,
)
if use_gpu:
visitor = ldf.visit()
try:
gdf, profile = execute_plan(visitor, profile=True)
if return_on_gpu:
return gdf, profile.as_dataframe()
else:
result = pl.from_arrow(gdf.to_arrow())
for name, val in gdf.sorted().items():
if val != DataFrame.IsSorted.NOT:
result = result.set_sorted(
name,
descending=val
is DataFrame.IsSorted.DESCENDING,
)
return result, profile.as_dataframe()
except Exception:
if cpu_fallback:
# CPU fallback
print("Didn't execute successfully on GPU")
else:
raise
return tuple(map(wrap_df, ldf.profile()))

# This is our one (hopefully) API hook for monkeypatching so that
# we can seamlessly run polars plans on GPU
pl.LazyFrame.collect = collect_with_gpu
pl.LazyFrame.profile = profile_with_gpu
Loading

0 comments on commit 7c2e8e6

Please sign in to comment.