Skip to content

Add missing thrust headers & Pass dtype objects to cuDF as_column #5023

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

Merged
merged 12 commits into from
Apr 11, 2025

Conversation

alliepiper
Copy link
Contributor

@alliepiper alliepiper commented Apr 10, 2025

Note by @jakirkham this includes C++ and Python fixes needed for CI. Details below:


From @alliepiper :

Discovered in CCCL CI.

/usr/bin/sccache /home/coder/.conda/envs/rapids/bin/nvcc -forward-unknown-to-host-compiler -ccbin=/home/coder/.conda/envs/rapids/bin/x86_64-conda-linux-gnu-c++ -DCUDA_API_PER_THREAD_DEFAULT_STREAM -DCUTLASS_NAMESPACE=raft_cutlass -DLIBCUDACXX_ENABLE_EXPERIMENTAL_MEMORY_RESOURCE -DRAFT_COMPILED -DRAFT_LOG_ACTIVE_LEVEL=RAPIDS_LOGGER_LOG_LEVEL_INFO -DRAFT_SYSTEM_LITTLE_ENDIAN=1 -DTHRUST_DEVICE_SYSTEM=THRUST_DEVICE_SYSTEM_CUDA -DTHRUST_DISABLE_ABI_NAMESPACE -DTHRUST_HOST_SYSTEM=THRUST_HOST_SYSTEM_CPP -DTHRUST_IGNORE_ABI_NAMESPACE_ERROR -Dcugraph_EXPORTS -I/home/coder/cugraph/cpp/../thirdparty -I/home/coder/cugraph/cpp/src -I/home/coder/cugraph/cpp/include -I/home/coder/cugraph/cpp/build/conda/cuda-12.8/release/_deps/cccl-src/lib/cmake/thrust/../../../thrust -I/home/coder/cugraph/cpp/build/conda/cuda-12.8/release/_deps/cccl-src/lib/cmake/libcudacxx/../../../libcudacxx/include -I/home/coder/cugraph/cpp/build/conda/cuda-12.8/release/_deps/cccl-src/lib/cmake/cub/../../../cub -I/home/coder/cugraph/cpp/build/conda/cuda-12.8/release/_deps/cuco-src/include -isystem /home/coder/rmm/include -isystem /home/coder/rmm/build/conda/cuda-12.8/release/include -isystem /home/coder/.conda/envs/rapids/targets/x86_64-linux/include -isystem /home/coder/.conda/envs/rapids/include -isystem /home/coder/raft/cpp/include -isystem /home/coder/raft/cpp/build/conda/cuda-12.8/release/include -isystem /home/coder/raft/cpp/build/conda/cuda-12.8/release/_deps/nvidiacutlass-src/include -isystem /home/coder/raft/cpp/build/conda/cuda-12.8/release/_deps/nvidiacutlass-build/include -t=1 -O3 -DNDEBUG -std=c++17 "--generate-code=arch=compute_70,code=[sm_70]" -Xcompiler=-fPIC --expt-extended-lambda --expt-relaxed-constexpr -Werror=cross-execution-space-call -Wno-deprecated-declarations -DRAFT_HIDE_DEPRECATION_WARNINGS -Xptxas=--disable-warnings -Xcompiler=-Wall,-Wno-error=sign-compare,-Wno-error=unused-but-set-variable -Xfatbin=-compress-all -MD -MT CMakeFiles/cugraph.dir/src/detail/utility_wrappers_64.cu.o -MF CMakeFiles/cugraph.dir/src/detail/utility_wrappers_64.cu.o.d -x cu -c /home/coder/cugraph/cpp/src/detail/utility_wrappers_64.cu -o CMakeFiles/cugraph.dir/src/detail/utility_wrappers_64.cu.o
nvcc warning : Support for offline compilation for architectures prior to '<compute/sm/lto>_75' will be removed in a future release (Use -Wno-deprecated-gpu-targets to suppress warning).
/home/coder/cugraph/cpp/src/detail/utility_wrappers_impl.cuh(191): error: namespace "thrust" has no member "equal"
    return thrust::equal(handle.get_thrust_policy(), span1.begin(), span1.end(), span2.begin());

Cugraph CI was failing on this PR with several other missing thrust headers, adding those as I discover them.


From @mroeschke :

With rapidsai/cudf#18331, cuDF now requires values passed to dtype in as_column to be supported data type objects recognized by cuDF (cuDF's custom types or np.dtype).

I only found this usage which was passing np.int32 instead of np.dtype(np.int32) which should fix the failures on the Python build

@alliepiper alliepiper requested a review from a team as a code owner April 10, 2025 14:16
@alliepiper alliepiper changed the title Add missing thrust header to utility_wrappers_impl.cuh Add missing thrust headers Apr 10, 2025
Copy link
Contributor

@seunghwak seunghwak left a comment

Choose a reason for hiding this comment

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

LGTM and thanks for the fix!

@seunghwak seunghwak added improvement Improvement / enhancement to an existing function non-breaking Non-breaking change labels Apr 10, 2025
@alliepiper
Copy link
Contributor Author

The python errors look unrelated:

AttributeError: type object 'numpy.int32' has no attribute 'kind'

Are these known issues?

@bdice
Copy link
Contributor

bdice commented Apr 10, 2025

@mroeschke Any thoughts on the kind issue?

@jakirkham
Copy link
Member

Sounds like the sort of thing where something gets a NumPy type, but expects a dtype

In [1]: import numpy as np

In [2]: np.int32.kind
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In[2], line 1
----> 1 np.int32.kind

AttributeError: type object 'numpy.int32' has no attribute 'kind'

In [3]: np.dtype(np.int32).kind
Out[3]: 'i'

Pretty simple to push whatever type (or dtype) through the constructor for np.dtype

@mroeschke
Copy link
Contributor

mroeschke commented Apr 10, 2025

Yup, looks like there is a call to cuDF's as_column that is passing np.int32 instead of np.dtype(np.int32) which was a recent change in cuDF Python

@jakirkham
Copy link
Member

jakirkham commented Apr 10, 2025

For context this is the traceback from CI

        File "/opt/conda/envs/test/lib/python3.10/site-packages/cugraph/structure/hypergraph.py", line 633, in _str_scalar_to_category
          children=(cudf.core.column.as_column(0, length=size, dtype=np.int32),),
        File "/opt/conda/envs/test/lib/python3.10/site-packages/cudf/core/column/column.py", line 2843, in as_column
          col = col.astype(dtype)
        File "/opt/conda/envs/test/lib/python3.10/site-packages/cudf/core/column/column.py", line 1635, in astype
          elif dtype.kind == "M":
      AttributeError: type object 'numpy.int32' has no attribute 'kind'

Would it make sense to normalize type's to np.dtype during construction?

Not sure if we will also want to do this elsewhere

@mroeschke
Copy link
Contributor

Would it make sense to normalize type's to np.dtype during construction?

I have been working towards the cudf Python Column level to only accept/deal with dtype objects recently (makes things more straightforward) since it's supposed to be "private".

Type normalization usually is meant to happen in public cuDF public constructors e.g. cudf.Series/cudf.Dataframe

@jakirkham
Copy link
Member

jakirkham commented Apr 10, 2025

Hmm...in that case could we add some validation of input types upstream?

As this discussion shows, the error message is not clear to everyone. Not to mention what should be the developer's next steps

Edit: Or do you mean cuGraph is using private APIs and should move away from those?

@mroeschke
Copy link
Contributor

mroeschke commented Apr 10, 2025

Hmm...in that case could we add some validation of input types upstream?

Yes definitely - I think this is good to add.

Or do you mean cuGraph is using private APIs and should move away from those?

This is also true. The cuDF Python "column" APIs technically private, but we've seen other RAPIDS projects sometime need to use them for one reason or another. I think some of them might be public eventually since there may not be workarounds for functionality if users start from public APIs

Nonetheless, I can open a cugraph PR to fix these Python tests.

@jakirkham
Copy link
Member

Thanks Matthew! 🙏

If there is a good way to use public APIs here, would be interested in your thoughts on how best to do so 🙂

Can see you opened PR: #5025

Given that one will fail due to the CCCL changes that this PR fixes, would it be alright if we merged it into this PR?

@alliepiper alliepiper requested a review from a team as a code owner April 10, 2025 22:53
@alliepiper
Copy link
Contributor Author

alliepiper commented Apr 10, 2025

@jakirkham I've pulled those changes in here. Thanks!

@jakirkham
Copy link
Member

Thanks Allison! 🙏

@jakirkham jakirkham changed the title Add missing thrust headers Add missing thrust headers & Pass dtype objects to cuDF as_column Apr 10, 2025
@jakirkham
Copy link
Member

Updated the title and description to pull in Matthew's PR info. Hope that is ok

@rlratzel
Copy link
Contributor

/merge

@rapids-bot rapids-bot bot merged commit 7513499 into rapidsai:branch-25.06 Apr 11, 2025
81 checks passed
@alliepiper alliepiper deleted the patch-1 branch April 11, 2025 13:11
@rlratzel
Copy link
Contributor

Thanks @alliepiper for this!

@jakirkham
Copy link
Member

Indeed thanks Allison and Matthew for your fixes! Also thanks to the broader group for helping swarm, review, and reach out to folks for support 🙏

Glad we are getting CI back to green 🟢

MathisHammel pushed a commit to MathisHammel/cugraph that referenced this pull request Apr 19, 2025
…pidsai#5023)

Note by @jakirkham this includes C++ and Python fixes needed for CI. Details below:

<hr>

From @alliepiper :

Discovered in CCCL CI.

```
/usr/bin/sccache /home/coder/.conda/envs/rapids/bin/nvcc -forward-unknown-to-host-compiler -ccbin=/home/coder/.conda/envs/rapids/bin/x86_64-conda-linux-gnu-c++ -DCUDA_API_PER_THREAD_DEFAULT_STREAM -DCUTLASS_NAMESPACE=raft_cutlass -DLIBCUDACXX_ENABLE_EXPERIMENTAL_MEMORY_RESOURCE -DRAFT_COMPILED -DRAFT_LOG_ACTIVE_LEVEL=RAPIDS_LOGGER_LOG_LEVEL_INFO -DRAFT_SYSTEM_LITTLE_ENDIAN=1 -DTHRUST_DEVICE_SYSTEM=THRUST_DEVICE_SYSTEM_CUDA -DTHRUST_DISABLE_ABI_NAMESPACE -DTHRUST_HOST_SYSTEM=THRUST_HOST_SYSTEM_CPP -DTHRUST_IGNORE_ABI_NAMESPACE_ERROR -Dcugraph_EXPORTS -I/home/coder/cugraph/cpp/../thirdparty -I/home/coder/cugraph/cpp/src -I/home/coder/cugraph/cpp/include -I/home/coder/cugraph/cpp/build/conda/cuda-12.8/release/_deps/cccl-src/lib/cmake/thrust/../../../thrust -I/home/coder/cugraph/cpp/build/conda/cuda-12.8/release/_deps/cccl-src/lib/cmake/libcudacxx/../../../libcudacxx/include -I/home/coder/cugraph/cpp/build/conda/cuda-12.8/release/_deps/cccl-src/lib/cmake/cub/../../../cub -I/home/coder/cugraph/cpp/build/conda/cuda-12.8/release/_deps/cuco-src/include -isystem /home/coder/rmm/include -isystem /home/coder/rmm/build/conda/cuda-12.8/release/include -isystem /home/coder/.conda/envs/rapids/targets/x86_64-linux/include -isystem /home/coder/.conda/envs/rapids/include -isystem /home/coder/raft/cpp/include -isystem /home/coder/raft/cpp/build/conda/cuda-12.8/release/include -isystem /home/coder/raft/cpp/build/conda/cuda-12.8/release/_deps/nvidiacutlass-src/include -isystem /home/coder/raft/cpp/build/conda/cuda-12.8/release/_deps/nvidiacutlass-build/include -t=1 -O3 -DNDEBUG -std=c++17 "--generate-code=arch=compute_70,code=[sm_70]" -Xcompiler=-fPIC --expt-extended-lambda --expt-relaxed-constexpr -Werror=cross-execution-space-call -Wno-deprecated-declarations -DRAFT_HIDE_DEPRECATION_WARNINGS -Xptxas=--disable-warnings -Xcompiler=-Wall,-Wno-error=sign-compare,-Wno-error=unused-but-set-variable -Xfatbin=-compress-all -MD -MT CMakeFiles/cugraph.dir/src/detail/utility_wrappers_64.cu.o -MF CMakeFiles/cugraph.dir/src/detail/utility_wrappers_64.cu.o.d -x cu -c /home/coder/cugraph/cpp/src/detail/utility_wrappers_64.cu -o CMakeFiles/cugraph.dir/src/detail/utility_wrappers_64.cu.o
nvcc warning : Support for offline compilation for architectures prior to '<compute/sm/lto>_75' will be removed in a future release (Use -Wno-deprecated-gpu-targets to suppress warning).
/home/coder/cugraph/cpp/src/detail/utility_wrappers_impl.cuh(191): error: namespace "thrust" has no member "equal"
    return thrust::equal(handle.get_thrust_policy(), span1.begin(), span1.end(), span2.begin());
```

Cugraph CI was failing on this PR with several other missing thrust headers, adding those as I discover them.

<hr>

From @mroeschke :


With rapidsai/cudf#18331, cuDF now requires values passed to `dtype` in `as_column` to be supported data type objects recognized by cuDF (cuDF's custom types or `np.dtype`).

I only found this usage which was passing `np.int32` instead of `np.dtype(np.int32)` which should fix the failures on the Python build

Authors:
  - Allison Piper (https://github.com/alliepiper)
  - Matthew Roeschke (https://github.com/mroeschke)

Approvers:
  - Seunghwa Kang (https://github.com/seunghwak)
  - Bradley Dice (https://github.com/bdice)
  - https://github.com/jakirkham
  - Rick Ratzel (https://github.com/rlratzel)

URL: rapidsai#5023
rapids-bot bot pushed a commit that referenced this pull request Apr 21, 2025
From the discussion in #5023, cugraph appears to be using some private cuDF Python APIs (from `cudf.core`). It appears their usage can be wholly replaced with public APIs which will prevent breakage as cuDF should be at liberty to modify private functionality.

This PR will require rapidsai/cudf#18485 to be merged first.

Authors:
  - Matthew Roeschke (https://github.com/mroeschke)

Approvers:
  - Rick Ratzel (https://github.com/rlratzel)

URL: #5028
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cuGraph improvement Improvement / enhancement to an existing function non-breaking Non-breaking change python
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants