Skip to content

Closes #3578: Update sort_cases_benchmark - #4650

Merged
ajpotts merged 1 commit into
Bears-R-Us:masterfrom
ajpotts:3578_Update_sort_cases_benchmark
Jul 9, 2025
Merged

ajpotts merged 1 commit into
Bears-R-Us:masterfrom
ajpotts:3578_Update_sort_cases_benchmark

Conversation

@ajpotts

@ajpotts ajpotts commented Jun 20, 2025 •

Copy link
Copy Markdown
Contributor

PR: Enhance sort_cases_benchmark.py with Tuple and NumPy Support

This PR refactors the run_sort helper function used throughout sort_cases_benchmark.py to robustly support both:

  • ✅ Coargsort-style sorting using tuple inputs (e.g., (a, b))
  • ✅ NumPy fallback mode via --numpy
  • ✅ Correctness checks via --correctness_only

🔧 Key Improvements

  • Tuple Support for coargsort

    • Automatically detects and handles tuple inputs (e.g., for RMAT, refinement, IP-like benchmarks)
    • Computes total problem size and memory footprint using all tuple elements
  • NumPy Compatibility

    • Uses np.argsort for 1D arrays and np.lexsort for tuples when --numpy is enabled
    • Converts Arkouda arrays to NumPy with .to_ndarray() automatically
  • Correctness Checking

    • Ensures output is sorted (where feasible) using ak.is_sorted(...)
    • Skips deep correctness for lexsort-style tuples (could be extended later)
  • Benchmark Metadata

    • Tracks backend (Arkouda or NumPy)
    • Records problem size and transfer rate (GiB/sec)

📂 Affected Benchmarks

  • Random uniform
  • Power law
  • Block sorted
  • RMAT
  • Refinement
  • IP-like
  • time_like

This update makes the sort benchmarks fully general, testable under multiple backends, and ready for continuous correctness and performance tracking.

Closes #3578: Update sort_cases_benchmark

@ajpotts
ajpotts force-pushed the 3578_Update_sort_cases_benchmark branch 2 times, most recently from cc85661 to d54ef14 Compare June 23, 2025 16:24
@ajpotts
ajpotts marked this pull request as ready for review June 23, 2025 16:31
@ajpotts
ajpotts requested a review from vasslitvinov June 25, 2025 15:55
@vasslitvinov

vasslitvinov commented Jun 26, 2025 •

Copy link
Copy Markdown
Contributor

Github question: any idea why the diffs show this function completely rewritten?

def do_argsort(data, algo):
    if isinstance(data, (ak.pdarray, ak.Strings)):
        return ak.argsort(data, algo)
    else:
        return ak.coargsort(data, algo)

The diffs disappear if I click "hide whitespace". Are there whitespace changes? I am not seeing them. :(

This is not holding me up or anything, just puzzling.

[after-thought:] maybe the newlines have changed from Windows to Unix or the other way?

@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.

See the comment. The PR description should also mention time_like since you list the affected tests.

Comment thread benchmark_v2/sort_cases_benchmark.py Resolved
@ajpotts
ajpotts force-pushed the 3578_Update_sort_cases_benchmark branch from d54ef14 to 866ab4b Compare June 30, 2025 21:09

@1RyanK 1RyanK 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 9, 2025
Merged via the queue into Bears-R-Us:master with commit 24403b8 Jul 9, 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 sort_cases_benchmark

3 participants