Skip to content

Closes #3577: Update setops_benchmark - #4646

Merged
ajpotts merged 1 commit into
Bears-R-Us:masterfrom
ajpotts:3577_Update_setops_benchmark
Jul 10, 2025
Merged

ajpotts merged 1 commit into
Bears-R-Us:masterfrom
ajpotts:3577_Update_setops_benchmark

Conversation

@ajpotts

@ajpotts ajpotts commented Jun 20, 2025 •

Copy link
Copy Markdown
Contributor

This updates the setups benchmark. It also limits the size of the SegArray setops benchmark because it was timing out on the server.

PR: Refactor and Consolidate setops_benchmark.py with NumPy and SegArray Support

This PR updates setops_benchmark.py to unify benchmarking of Arkouda and NumPy set operations into a single function and adds a size-controlled SegArray benchmark for setops.

✅ Key Updates

  • Unified Setops Benchmark (bench_setops)

    • Supports both Arkouda and NumPy backends using the --numpy flag.
    • Converts Arkouda arrays to NumPy with .to_ndarray() for NumPy benchmarking.
    • Measures performance of intersect1d, union1d, setdiff1d, and setxor1d.
  • Correctness Verification (--correctness_only)

    • When enabled, validates Arkouda results against NumPy for all supported ops.
    • Ensures output correctness via np.testing.assert_array_equal.
  • SegArray Benchmark Reintroduced (bench_segarr_setops_small)

    • Adds a dedicated benchmark for SegArray set operations.
    • Reduces the problem size to avoid hanging on the server.
    • Clearly labeled as "Segarray_Setops_Small" and marked with @pytest.mark.skip_numpy(True) to reflect non-NumPy compatibility.

🔧 Other Improvements

  • Standardized byte accounting for throughput (GiB/sec)
  • Uses shared seed and type handling logic
  • Groups results under "Setops" and "Segarray_Setops_Small" for clarity

This cleanup ensures consistent testing, easier maintenance, and prepares the benchmarks for future scaling and correctness integration.

Closes #3577: Update setops_benchmark

@ajpotts
ajpotts force-pushed the 3577_Update_setops_benchmark branch from fb25415 to 59866d8 Compare June 20, 2025 17:24
@ajpotts
ajpotts marked this pull request as ready for review June 20, 2025 19:37
@ajpotts
ajpotts requested a review from vasslitvinov June 25, 2025 15:55

@vasslitvinov vasslitvinov left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest adding "skipif" if the given dtype is not supported by the server, like you have done in other cases. Otherwise looks good.

Comment thread benchmark_v2/setops_benchmark.py Resolved
@ajpotts
ajpotts force-pushed the 3577_Update_setops_benchmark branch from 59866d8 to 6cc2b3e Compare June 30, 2025 20:54
@ajpotts
ajpotts force-pushed the 3577_Update_setops_benchmark branch from 6cc2b3e to 10cb84d Compare July 9, 2025 15:27

@drculhane drculhane left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks solid to me, and when I run the benchmark locally, it seems to work as advertised.

I'm a bit surprised at:

if dtype == "int64":
   a = ak.randint (0,2**32,N,seed=seed)
   etc...
elif dtype == "uint64":
   a = ak.randint(0,2**32,N,seed=seed,dtype=ak.uint64)
   etc...

instead of:
a = ak.randint(0,2**32,N,seed=seed,dtype=dtype)

without the if and elif. Is there a reason not to do it that way?

@ajpotts
ajpotts force-pushed the 3577_Update_setops_benchmark branch from 10cb84d to 901d03f Compare July 10, 2025 16:38
@ajpotts

ajpotts commented Jul 10, 2025

Copy link
Copy Markdown
Contributor Author

@drculhane I simplified the logic as you recommended.

@ajpotts
ajpotts enabled auto-merge July 10, 2025 16:41

@jaketrookman jaketrookman left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

@ajpotts
ajpotts added this pull request to the merge queue Jul 10, 2025
Merged via the queue into Bears-R-Us:master with commit 3833754 Jul 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update setops_benchmark

4 participants