-
Notifications
You must be signed in to change notification settings - Fork 16
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
Remove NumPy <2 pin #33
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good to me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's tough to be confident in this without any CI. But since @linhu-nv was ok merging this I'm ok with it. If this doesn't actually work, we'll find out when CI is eventually added here.
I did at least try the ruff
NumPy 2 rule, and saw some deprecations but no uses of fully-removed APIs.
ruff check --select NPY .
Just 10 variations of this:
python/cugraph-dgl/cugraph_dgl/tests/test_graph.py:35:11: NPY002 Replace legacy `np.random.random` call with `np.random.Generator`
full logs (click me)
python/cugraph-dgl/cugraph_dgl/tests/test_graph.py:35:11: NPY002 Replace legacy `np.random.random` call with `np.random.Generator`
|
33 | df.src = df.src.astype("int64")
34 | df.dst = df.dst.astype("int64")
35 | wgt = np.random.random((len(df),))
| ^^^^^^^^^^^^^^^^ NPY002
36 |
37 | graph = cugraph_dgl.Graph()
|
python/cugraph-dgl/cugraph_dgl/tests/test_graph.py:39:14: NPY002 Replace legacy `np.random.random` call with `np.random.Generator`
|
37 | graph = cugraph_dgl.Graph()
38 | num_nodes = max(df.src.max(), df.dst.max()) + 1
39 | node_x = np.random.random((num_nodes,))
| ^^^^^^^^^^^^^^^^ NPY002
40 |
41 | graph.add_nodes(
|
python/cugraph-dgl/cugraph_dgl/tests/test_graph.py:112:16: NPY002 Replace legacy `np.random.random` call with `np.random.Generator`
|
110 | num_nodes_group_2 = total_num_nodes - num_nodes_group_1
111 |
112 | node_x_1 = np.random.random((num_nodes_group_1,))
| ^^^^^^^^^^^^^^^^ NPY002
113 | node_x_2 = np.random.random((num_nodes_group_2,))
|
python/cugraph-dgl/cugraph_dgl/tests/test_graph.py:113:16: NPY002 Replace legacy `np.random.random` call with `np.random.Generator`
|
112 | node_x_1 = np.random.random((num_nodes_group_1,))
113 | node_x_2 = np.random.random((num_nodes_group_2,))
| ^^^^^^^^^^^^^^^^ NPY002
114 |
115 | graph.add_nodes(num_nodes_group_1, {"x": node_x_1}, "type1")
|
python/cugraph-dgl/cugraph_dgl/tests/test_graph_mg.py:46:11: NPY002 Replace legacy `np.random.random` call with `np.random.Generator`
|
44 | df.src = df.src.astype("int64")
45 | df.dst = df.dst.astype("int64")
46 | wgt = np.random.random((len(df),))
| ^^^^^^^^^^^^^^^^ NPY002
47 |
48 | graph = cugraph_dgl.Graph(
|
python/cugraph-dgl/cugraph_dgl/tests/test_graph_mg.py:166:31: NPY002 Replace legacy `np.random.random` call with `np.random.Generator`
|
164 | num_nodes_group_2 = total_num_nodes - num_nodes_group_1
165 |
166 | node_x_1 = np.array_split(np.random.random((num_nodes_group_1,)), world_size)[rank]
| ^^^^^^^^^^^^^^^^ NPY002
167 | node_x_2 = np.array_split(np.random.random((num_nodes_group_2,)), world_size)[rank]
|
python/cugraph-dgl/cugraph_dgl/tests/test_graph_mg.py:167:31: NPY002 Replace legacy `np.random.random` call with `np.random.Generator`
|
166 | node_x_1 = np.array_split(np.random.random((num_nodes_group_1,)), world_size)[rank]
167 | node_x_2 = np.array_split(np.random.random((num_nodes_group_2,)), world_size)[rank]
| ^^^^^^^^^^^^^^^^ NPY002
168 |
169 | graph.add_nodes(num_nodes_group_1, {"x": node_x_1}, "type1")
|
python/cugraph-pyg/cugraph_pyg/tests/data/test_dask_graph_store_mg.py:404:9: NPY002 Replace legacy `np.random.randint` call with `np.random.Generator`
|
402 | def test_cugraph_loader_large_index(dask_client):
403 | large_index = (
404 | np.random.randint(0, 1_000_000, (100_000_000,)),
| ^^^^^^^^^^^^^^^^^ NPY002
405 | np.random.randint(0, 1_000_000, (100_000_000,)),
406 | )
|
python/cugraph-pyg/cugraph_pyg/tests/data/test_dask_graph_store_mg.py:405:9: NPY002 Replace legacy `np.random.randint` call with `np.random.Generator`
|
403 | large_index = (
404 | np.random.randint(0, 1_000_000, (100_000_000,)),
405 | np.random.randint(0, 1_000_000, (100_000_000,)),
| ^^^^^^^^^^^^^^^^^ NPY002
406 | )
|
python/cugraph-pyg/cugraph_pyg/tests/data/test_dask_graph_store_mg.py:408:22: NPY002 Replace legacy `np.random.randint` call with `np.random.Generator`
|
406 | )
407 |
408 | large_features = np.random.randint(0, 50, (1_000_000,))
| ^^^^^^^^^^^^^^^^^ NPY002
409 | F = cugraph.gnn.FeatureStore(backend="torch")
410 | F.add_data(large_features, "N", "f")
|
Found 10 errors.
Probably worth rolling that out across RAPIDS to get ahead of those things being removed in future NumPy versions. But that doesn't have to block this PR.
Thanks James! 🙏 For NumPy 2 specifically, we have used the That said, Ruff includes a few NumPy rules (using Agree it is worth adding these across RAPIDS. For planning & discussion, have opened issue: rapidsai/build-planning#103 |
Going to go ahead and merge as this has been approved As James notes, we will only know if there are issues once there is CI. That said, this will make it easier to test NumPy 2 on CI to learn those issues early on (so we will have time to work through them) |
This PR removes the NumPy<2 pin which is expected to work for
RAPIDS projects once CuPy 13.3.0 is released (CuPy 13.2.0 had
some issues preventing the use with NumPy 2).