NVIDIA / NVIDIA/cccl

[BUG]: Fail to build a project with object that are template instantiate of thrust::complex.

Open
#1,876 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
2.5k
Forks
486
Avg merge
2d 6h
Merged PRs (30d)
295

Description

### Is this a duplicate?

- [X] I confirmed there appear to be no [duplicate issues](https://github.com/NVIDIA/cccl/issues) for this bug and that I agree to the [Code of Conduct](CODE_OF_CONDUCT.md)

### Type of Bug

Compile-time Error

### Component

Thrust

### Describe the bug

Fail to build a project with object that are template instantiate of thrust::complex.
```
[yehonatans@srv12 build]$ cmake ..
-- The CXX compiler identification is GNU 11.4.1
-- The CUDA compiler identification is NVIDIA 12.5.40
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Detecting CUDA compiler ABI info
-- Detecting CUDA compiler ABI info - done
-- Check for working CUDA compiler: /usr/local/cuda/bin/nvcc - skipped
-- Detecting CUDA compile features
-- Detecting CUDA compile features - done
-- Found CUDAToolkit: /usr/local/cuda/include (found version "12.5.40")
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- Configuring done (8.4s)
-- Generating done (0.1s)
-- Build files have been written to: /home/Yehonatans/CLionProjects/CudaTemplateInstansiation/build
[yehonatans@srv12 build]$ make
[ 25%] Building CXX object CMakeFiles/CudaTemplateInstansiation.dir/main.cpp.o
[ 50%] Building CUDA object CMakeFiles/CudaTemplateInstansiation.dir/tt.cu.o
[ 75%] Linking CUDA device code CMakeFiles/CudaTemplateInstansiation.dir/cmake_device_link.o
[100%] Linking CXX executable CudaTemplateInstansiation
/bin/ld: CMakeFiles/CudaTemplateInstansiation.dir/main.cpp.o: in function `main':
main.cpp:(.text+0x8a): undefined reference to `void funca >(thrust::THRUST_200400___CUDA_ARCH_LIST___NS::complex)'
/bin/ld: main.cpp:(.text+0xd0): undefined reference to `tt >::func(thrust::THRUST_200400___CUDA_ARCH_LIST___NS::complex)'

```

### How to Reproduce

Build the c++ project without success with Cuda 12.4 or above
[proj.zip](https://github.com/user-attachments/files/15870906/proj.zip)

### Expected behavior

The build process will fail

### Reproduction link

_No response_

### Operating System

Rocky Linux 9 and 8

### nvidia-smi output

_No response_

### NVCC version

nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2024 NVIDIA Corporation
Built on Wed_Apr_17_19:19:55_PDT_2024
Cuda compilation tools, release 12.5, V12.5.40
Build cuda_12.5.r12.5/compiler.34177558_0

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.