-
Notifications
You must be signed in to change notification settings - Fork 188
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
[BUG]: #include <thrust/device_vector.h> causes compile error #1783
Comments
Thanks for raising this @Olli1080. Unfortunately, this is expected. See #1374 TL;DR: It was never intended that Out of curiosity, in your use case, what did you expect to be able to do with the |
Thank you for the clarification. My use case is to have thrust/device_vector as a private member of a class which can be consumed by C++ translation units e.g. outside of a library but to compile the definition of the class using CUDA. TL;DR: Exposing consumption of classes in host-only code, but also having the functionality inside the CUDA translation unit. |
For example here is a one such class i'm compiling with cuda but consuming in host-only code. |
@Olli1080 you can apply the PIMPL idiom to workaround this. Something along these lines: Header: class MetaPointCloud {
struct Impl;
std::unique_ptr<Impl> pimpl;
}; Source: struct MetaPointCloud::Impl {
thrust::device_vector<...> ...;
}; Make sure all constructors and destructors of |
I had some digging around in the code (using /showincludes) and found out that the errors are caused by the changes in <cub/util_device.cuh>, namely adding <cub/util_ptx.cuh> and <cuda/discard_memory>. Looking at the main branch both of these includes are now gone. I'll test if including host_vector or device_vector works again asap. For anyone interested the relevant include tree is: CUDA\thrust/host_vector.h |
I've tested CUDA 12.5 with replaced cccl headers and the issue does not exist anymore. |
Is this a duplicate?
Type of Bug
Compile-time Error
Component
Thrust
Describe the bug
When including thrust/device_vector in anywhere visible to a cpp compiled file it fails due to including device only code.
This issue is present in thrust shipped with CUDA 12.5 but was non existent in CUDA 12.3.
How to Reproduce
Expected behavior
Reproduction link
No response
Operating System
Windows 11 Pro 10.0.22621
nvidia-smi output
+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 555.85 Driver Version: 555.85 CUDA Version: 12.5 |
|-----------------------------------------+------------------------+----------------------+
| GPU Name Driver-Model | Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap | Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|=========================================+========================+======================|
| 0 NVIDIA GeForce GTX 970 WDDM | 00000000:01:00.0 On | N/A |
| 36% 41C P0 51W / 179W | 1123MiB / 4096MiB | 0% Default |
| | | N/A |
+-----------------------------------------+------------------------+----------------------+
NVCC version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2024 NVIDIA Corporation
Built on Wed_Apr_17_19:36:51_Pacific_Daylight_Time_2024
Cuda compilation tools, release 12.5, V12.5.40
Build cuda_12.5.r12.5/compiler.34177558_0
The text was updated successfully, but these errors were encountered: