Skip to content

Commit

Permalink
moved performance_report outside shuffle call
Browse files Browse the repository at this point in the history
  • Loading branch information
madsbk committed May 26, 2021
1 parent 5db9477 commit cf5f2c4
Showing 1 changed file with 21 additions and 35 deletions.
56 changes: 21 additions & 35 deletions dask_cuda/benchmarks/local_cudf_shuffle.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,38 +22,16 @@
from dask_cuda.utils import all_to_all


def shuffle_dask(args, df, write_profile):
if write_profile is None:
ctx = contextlib.nullcontext()
else:
ctx = performance_report(filename=args.profile)
def shuffle_dask(df):
wait(shuffle(df, index="data", shuffle="tasks").persist())

# Execute the operations to benchmark
with ctx:
t1 = clock()
wait(shuffle(df, index="data", shuffle="tasks").persist())
return clock() - t1


def shuffle_explicit_comms(args, df, write_profile):
if write_profile is not None:
with performance_report(filename=args.profile):
t1 = clock()
wait(
dask_cuda.explicit_comms.dataframe.shuffle.shuffle(
df, column_names="data"
).persist()
)
took = clock() - t1
else:
t1 = clock()
wait(
dask_cuda.explicit_comms.dataframe.shuffle.shuffle(
df, column_names="data"
).persist()
)
took = clock() - t1
return took

def shuffle_explicit_comms(df):
wait(
dask_cuda.explicit_comms.dataframe.shuffle.shuffle(
df, column_names="data"
).persist()
)


def run(client, args, n_workers, write_profile=None):
Expand All @@ -73,12 +51,20 @@ def run(client, args, n_workers, write_profile=None):
wait(df)
data_processed = len(df) * sum([t.itemsize for t in df.dtypes])

if args.backend == "dask":
took = shuffle_dask(args, df, write_profile)
if write_profile is None:
ctx = contextlib.nullcontext()
else:
took = shuffle_explicit_comms(args, df, write_profile)
ctx = performance_report(filename=args.profile)

with ctx:
t1 = clock()
if args.backend == "dask":
shuffle_dask(df)
else:
shuffle_explicit_comms(df)
t2 = clock()

return (data_processed, took)
return (data_processed, t2 - t1)


def main(args):
Expand Down

0 comments on commit cf5f2c4

Please sign in to comment.