Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simple NumPy 2 fixes that are clearly no behavior change #15876

Merged
merged 5 commits into from
May 30, 2024

Conversation

seberg
Copy link
Contributor

@seberg seberg commented May 29, 2024

I have a branch that works, but some changes may need a bit of thought to get right, so splitting out the simpler half.

(N.B. the only bigger chunk that is remaining is to make sure that uint_series > -1 keeps working at least as well as before)

In either case, these are changes that:

  • Avoid copy=False in np.array()
  • Are necessary due to NumPy rejecting e.g. uint8(-1) now (only changed this where it is test-only)
  • Are necessary due to NumPy preserving the scalar dtype things fail later (the hashing code and using float(float32) to avoid overflow.
    • Sorting change is the same, using int8(-1) gives effectively the old promotion (to float) rather than erroring to not implicit go to float based on the value.

The main noise, is that I parametrized that one test since it seemed easy enough.

xref: rapidsai/build-planning#38

@seberg seberg requested a review from a team as a code owner May 29, 2024 10:26
@seberg seberg requested review from wence- and galipremsagar May 29, 2024 10:26
@github-actions github-actions bot added the Python Affects Python cuDF API. label May 29, 2024
Copy link

copy-pr-bot bot commented May 29, 2024

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@seberg seberg force-pushed the numpy2-simple-fixes branch 2 times, most recently from 4c3cb2b to 90ab9fe Compare May 29, 2024 12:55
@seberg
Copy link
Contributor Author

seberg commented May 29, 2024

Had to replace the last commit. There are too many uint64s around to work with Python ints on NumPy 1, so need to use uint64 explicitly in more places to make it work with NumPy 2 and 1 logic.

Using uint8 fails because mixing it with Python integers try to
stick with uint8 on NumPy 2.
Using Python integers fails some NumPy 1.x paths, because mixing
them with uint64 scalars fails on NumPy 1.

uint64 should work on both versions.

Also moved a warnings ignore from the tests to the function
@seberg seberg force-pushed the numpy2-simple-fixes branch from 90ab9fe to ce37898 Compare May 29, 2024 13:00
@lithomas1 lithomas1 added improvement Improvement / enhancement to an existing function non-breaking Non-breaking change labels May 29, 2024
Copy link
Contributor

@wence- wence- left a comment

Choose a reason for hiding this comment

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

No real quibbles, just a few questions and one (possible) cleanup

python/cudf/cudf/tests/test_sorting.py Show resolved Hide resolved
python/cudf/cudf/utils/hash_vocab_utils.py Show resolved Hide resolved
python/cudf/cudf/utils/hash_vocab_utils.py Show resolved Hide resolved
@galipremsagar
Copy link
Contributor

/merge

@rapids-bot rapids-bot bot merged commit 579a167 into rapidsai:branch-24.08 May 30, 2024
70 checks passed
@seberg seberg deleted the numpy2-simple-fixes branch May 30, 2024 17:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement Improvement / enhancement to an existing function non-breaking Non-breaking change Python Affects Python cuDF API.
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants