1

Apologies - I'm aware there's a similar question, however I'm new to SO, so I'm unable to comment underneath the answer.

I'm having issues with sort_values in a vanilla install of cudf as per the RAPIDs website:

conda create -n rapids-22.08 -c rapidsai -c nvidia -c conda-forge cudf=22.08 python=3.9 cudatoolkit=11.0

N.B. I used CUDA 11.0 as the toolkit version instead of 11.5, as 11.5 was failing to download for some reason.

I have tried to run the following code

import cudf
df = cudf.DataFrame()
df['a'] = [0, 1, 2]
df['b'] = [-3, 2, 0]
df.sort_values('b')

and it has thrown the following error

Traceback (most recent call last):
  File "/home/ruser/workspace/benchmark/test_cudf.py", line 5, in <module>
    df.sort_values('b')
  File "/home/ruser/.conda/envs/rapids-22.08/lib/python3.9/site-packages/cudf/core/indexed_frame.py", line 1901, in sort_values
    out = self._gather(
  File "/home/ruser/.conda/envs/rapids-22.08/lib/python3.9/site-packages/cudf/core/indexed_frame.py", line 1500, in _gather
    if not libcudf.copying._gather_map_is_valid(
  File "copying.pyx", line 67, in cudf._lib.copying._gather_map_is_valid
  File "/home/ruser/.conda/envs/rapids-22.08/lib/python3.9/site-packages/cudf/core/mixins/mixin_factory.py", line 11, in wrapper
    return method(self, *args1, *args2, **kwargs1, **kwargs2)
  File "/home/ruser/.conda/envs/rapids-22.08/lib/python3.9/site-packages/cudf/core/scalar.py", line 284, in _binaryop
    return Scalar(result, dtype=out_dtype)
  File "/home/ruser/.conda/envs/rapids-22.08/lib/python3.9/site-packages/cudf/core/scalar.py", line 76, in __init__
    self._host_value, self._host_dtype = self._preprocess_host_value(
  File "/home/ruser/.conda/envs/rapids-22.08/lib/python3.9/site-packages/cudf/core/scalar.py", line 157, in _preprocess_host_value
    value = to_cudf_compatible_scalar(value, dtype=dtype)
  File "/home/ruser/.conda/envs/rapids-22.08/lib/python3.9/site-packages/cudf/utils/dtypes.py", line 247, in to_cudf_compatible_scalar
    raise ValueError(
ValueError: Cannot convert value of type NotImplementedType to cudf scalar

Elsewhere the cudf library seems to be working fine - and results map one-to-one with various numpy comparisons I've done, so it seems largely ringfenced to sort_values() Any help as to how to workaround this would be greatly appreciated!

dcgt1
  • 33
  • 3
  • I'm not able to reproduce this with the same environment create command on my Ubuntu 20.04 system. Could you file an issue on https://github.com/rapidsai/cudf/issues/ and run the script to print key environment/system details? – Nick Becker Oct 02 '22 at 18:21
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Oct 02 '22 at 19:03
  • @NickBecker I seem to have tracked down the cause of the problem, but not exactly sure how it's happening. The server I'm running it on has both Cuda 11.0 and 11.7 installed, and even though /usr/local/cuda pointed to 11.0, some residual parts were still appearing to point to 11.7. Removing 11.7 has done the trick. – dcgt1 Oct 03 '22 at 13:04
  • This issue ended up being caused by changes in NumPy 1.23. If you downgrade to NumPy 1.22, things will work as expected. cuDF now pins to NumPy < 1.23 to avoid this. – Nick Becker Oct 07 '22 at 01:05
  • Sorry yes, you're completely right, tried it again with 11.7 and it works fine with the pinned numpy version. Apologies for misleading in my answer – dcgt1 Oct 08 '22 at 18:28

1 Answers1

0

The problem appears to have some sort of connection to the fact that CUDA 11.7 was also installed on the container - even though the default version was 11.0. Removing 11.7 from the image and rebuilding did the trick. Apologies!

Edit: It actually turned out to be as a result of numpy 1.23 being incompatible with cudf 22.08. With numpy now being pinned to <1.23, it works absolutely fine.

dcgt1
  • 33
  • 3
  • great job debugging, but you should only need CUDA 11.7 and remove CUDA 11.0 instead . With CUDA compatibility layer introduced in CUDA 11, cudatoolkit (CTK) of a lower minor version than the CUDA version installed will work just fine – TaureanDyerNV Oct 06 '22 at 19:39
  • same issues, downgrading numpy to 1.22 did the trick, thanks – Oleg Nov 04 '22 at 12:01