Skip to content

[BUG]: thrust::cuda_cub::launcher::triple_chevron is called in headers even for non CUDA compilers #3376

@caugonnet

Description

@caugonnet

Is this a duplicate?

Type of Bug

Compile-time Error

Component

Thrust

Describe the bug

When compiling cuGraph code with a recent CCCL, some .cpp file compiled with a non CUDA compiler includes headers which eventually include headers that do need a CUDA compiler.

I am not sure if the problem is in RAFT, RMM, Thrust or CUB here ! Maybe some additional safeguard in CCCL headers would be helpful to detect we are using an inappropriate compiler earlier in the list of nested includes ?

In file included from /home/caugonnet/git/caugonnet_cugraph/cpp/build/_deps/cccl-src/lib/cmake/cub/../../../cub/cub/detail/launcher/cuda_runtime.cuh:15,
                 from /home/caugonnet/git/caugonnet_cugraph/cpp/build/_deps/cccl-src/lib/cmake/cub/../../../cub/cub/util_device.cuh:762,
                 from /home/caugonnet/git/caugonnet_cugraph/cpp/build/_deps/cccl-src/lib/cmake/thrust/../../../thrust/thrust/system/cuda/detail/util.h:42,
                 from /home/caugonnet/git/caugonnet_cugraph/cpp/build/_deps/cccl-src/lib/cmake/thrust/../../../thrust/thrust/system/cuda/detail/malloc_and_free.h:36,
                 from /home/caugonnet/git/caugonnet_cugraph/cpp/build/_deps/cccl-src/lib/cmake/thrust/../../../thrust/thrust/system/detail/adl/malloc_and_free.h:50,
                 from /home/caugonnet/git/caugonnet_cugraph/cpp/build/_deps/cccl-src/lib/cmake/thrust/../../../thrust/thrust/system/detail/generic/memory.inl:32,
                 from /home/caugonnet/git/caugonnet_cugraph/cpp/build/_deps/cccl-src/lib/cmake/thrust/../../../thrust/thrust/system/detail/generic/memory.h:70,
                 from /home/caugonnet/git/caugonnet_cugraph/cpp/build/_deps/cccl-src/lib/cmake/thrust/../../../thrust/thrust/detail/reference.h:38,
                 from /home/caugonnet/git/caugonnet_cugraph/cpp/build/_deps/cccl-src/lib/cmake/thrust/../../../thrust/thrust/memory.h:35,
                 from /home/caugonnet/git/caugonnet_cugraph/cpp/build/_deps/cccl-src/lib/cmake/thrust/../../../thrust/thrust/device_ptr.h:33,
                 from /home/caugonnet/git/caugonnet_cugraph/cpp/build/_deps/cccl-src/lib/cmake/thrust/../../../thrust/thrust/device_free.h:32,
                 from /home/caugonnet/git/caugonnet_cugraph/cpp/build/_deps/cccl-src/lib/cmake/thrust/../../../thrust/thrust/device_malloc_allocator.h:32,
                 from /home/caugonnet/git/caugonnet_cugraph/cpp/build/_deps/rmm-src/include/rmm/mr/device/thrust_allocator_adaptor.hpp:26,
                 from /home/caugonnet/git/caugonnet_cugraph/cpp/build/_deps/rmm-src/include/rmm/exec_policy.hpp:27,
                 from /home/caugonnet/git/caugonnet_cugraph/cpp/build/_deps/raft-src/cpp/include/raft/core/resource/thrust_policy.hpp:22,
                 from /home/caugonnet/git/caugonnet_cugraph/cpp/build/_deps/raft-src/cpp/include/raft/core/device_resources.hpp:35,
                 from /home/caugonnet/git/caugonnet_cugraph/cpp/build/_deps/raft-src/cpp/include/raft/core/handle.hpp:19,
                 from /home/caugonnet/git/caugonnet_cugraph/cpp/include/cugraph/utilities/dataframe_buffer.hpp:20,
                 from /home/caugonnet/git/caugonnet_cugraph/cpp/include/cugraph/edge_property.hpp:19,
                 from /home/caugonnet/git/caugonnet_cugraph/cpp/include/cugraph/algorithms.hpp:20:
/home/caugonnet/git/caugonnet_cugraph/cpp/build/_deps/cccl-src/lib/cmake/thrust/../../../thrust/thrust/system/cuda/detail/core/triple_chevron_launch.h: In member function 'cudaError_t thrust::cuda_cub::launcher::triple_chevron::doit_host(K, const Args& ...) const':
/home/caugonnet/git/caugonnet_cugraph/cpp/build/_deps/cccl-src/lib/cmake/thrust/../../../thrust/thrust/system/cuda/detail/core/triple_chevron_launch.h:112:10: error: expected primary-expression before '<' token
  112 |       k<<<grid, block, shared_mem, stream>>>(args...);
      |          ^
/home/caugonnet/git/caugonnet_cugraph/cpp/build/_deps/cccl-src/lib/cmake/thrust/../../../thrust/thrust/system/cuda/detail/core/triple_chevron_launch.h:112:44: error: expected primary-expression before '>' token
  112 |       k<<<grid, block, shared_mem, stream>>>(args...);
      |                                            ^
/home/caugonnet/git/caugonnet_cugraph/cpp/build/_deps/cccl-src/lib/cmake/thrust/../../../thrust/thrust/system/cuda/detail/core/triple_chevron_launch.h:112:50: error: expected ')' before '...' token
  112 |       k<<<grid, block, shared_mem, stream>>>(args...);
      |                                                  ^~~
/home/caugonnet/git/caugonnet_cugraph/cpp/build/_deps/cccl-src/lib/cmake/thrust/../../../thrust/thrust/system/cuda/detail/core/triple_chevron_launch.h:112:45: note: to match this '('
  112 |       k<<<grid, block, shared_mem, stream>>>(args...);
      |                                             ^

How to Reproduce

Compile the cpp lib for that branch which updates CCCL in cuGraph rapidsai/cugraph#4833

Expected behavior

The RAFT header should be compilable from any compiler, or report some error earlier

Reproduction link

No response

Operating System

No response

nvidia-smi output

No response

NVCC version

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working right.

    Type

    No type

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions