NVIDIA / NVIDIA/cudf

[FEA] For cuDF `bench_merge`, make output size scale with input size

Open
#12,276 0 comments 0 reactions 0 assignees View on GitHub
feature request proposal Python
Dominant language
C++
Stars
9.8k
Forks
1.1k
Avg merge
3d 6m
Merged PRs (30d)
278

Description

**Is your feature request related to a problem? Please describe.**
The benchmark [bench_merge](https://github.com/rapidsai/cudf/blob/ff3b64325d3ac48fc0e8e0e9e1cf6246dd4aa075/python/cudf/benchmarks/API/bench_dataframe.py#L32) in [bench_dataframe.py](https://github.com/rapidsai/cudf/blob/branch-23.02/python/cudf/benchmarks/API/bench_dataframe.py) yields geometrically-increasing output size when `num_key_cols=2` . As a result, this particular benchmark runs into out-of-memory failures long before any other in the benchmarking suite.

**Describe the solution you'd like**
I would like to add a data generator with characteristics that make the output row count a roughly constant multiple of the input row count.

**Describe alternatives you've considered**
One alternative is to disable this benchmark for row counts >1M. However, cuDF join performance is one of its strongest features and we don't want to restrict our benchmarking to smaller tables.

**Additional context**
Here is a code snippet that demonstrates the problem as well as a potential solution.
```
import string
import cupy
import cudf

random_state = cupy.random.RandomState(42)
column_generators = {
"int": (lambda nr: random_state.randint(low=0, high=100, size=nr)),
"inthc": (lambda nr: random_state.randint(low=0, high=nr ** 0.5, size=nr)),
}

for gen in ['int', 'inthc']:
print(f'using column generator key {gen}')
for nr in [100, 10_000, 100_000, 1_000_000]:
df = cudf.DataFrame({f"{string.ascii_lowercase[i]}": column_generators[gen](nr) for i in range(6)})
m = df.merge(df, on=['a', 'b'])
print('for input size {}, output size is {} (the ratio is {:.2f})'.format(nr, len(m), len(m)/nr))
```

```
using column generator key int
for input size 100, output size is 100 (the ratio is 1.00)
for input size 10000, output size is 20234 (the ratio is 2.02)
for input size 100000, output size is 1100538 (the ratio is 11.01)
for input size 1000000, output size is 101002012 (the ratio is 101.00)
using column generator key inthc
for input size 100, output size is 214 (the ratio is 2.14)
for input size 10000, output size is 19868 (the ratio is 1.99)
for input size 100000, output size is 199970 (the ratio is 2.00)
for input size 1000000, output size is 2000782 (the ratio is 2.00)
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.