-
Notifications
You must be signed in to change notification settings - Fork 140
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]: Can't get correct result when use cub in CUDA12.0 #668
Comments
Hi @YuanRisheng! Thanks for submitting this issue - the CCCL team has been notified and we'll get back to you as soon as we can! |
@gevtushenko Please help me again. I reproduced this bug: NVIDIA/cub#719, I get incorrect result when I add |
The issue is that you are pulling in cccl sources of your CTK. That means we cannot do anything here as that has already shipped. You would need to actually pull in the cccl sources from github and use them in your project. |
@YuanRisheng to provide more detail, when you add:
it will override the include paths that are configured when you do:
So instead of picking up the version of CCCL downloaded from GitHub, it will use the version included in your CUDA Toolkit. The version in your CTK does not have the fix you need. Can you tell us more about why you need to do:
That's generally considered an anti-pattern in cmake these days and using target properties is preferred. Furthermore, this shouldn't be needed because when you do:
CMake will automatically detect and setup the include paths to your CTK. |
@jrhemstad Thank you for your reply. I need add: |
You do not need to update your CTK. Upgrading CCCL without upgrading your CTK is well supported. Let's use your
With this, cmake does a number of things for you automatically. Most importantly, it defines a bunch of targets for various components of the CTK, like So the best practice for doing what you're trying to do is the following:
Note how in addition to linking the |
@jrhemstad Thanks for your solution!Your solution inspired me and I have come up with a simpler solution. I only need add code below:
This will make cccl path override the cuda path and fix my bug. Thanks a lot!! |
@YuanRisheng while that will likely work, I recommend against using |
@jrhemstad I have tried but got some errors that my source code can't find header file. Maybe I need refactor my code in cmake. I will try this best practice again after this time. Thanks for your suggestion! |
Is this a duplicate?
Type of Bug
Something else
Component
CUB
Describe the bug
I get error result when I use
cub::DeviceReduce::Reduce
in CUDA12.0. This error occurs only when build shared target. This bug has been solved in NVIDIA/cub#719 before by using CCCL. But I found this problem is easily reproduced when I add cuda path in my CMakeList.txtHow to Reproduce
This is my code:
test_main.cc
test_functor.h
test_moduleA.cu
test_moduleB.cu
CMakeList code:
Please use
cmake -DCMAKE_BUILD_TYPE=Release ..
when build target.Please help me to deal with this issue. Thank you!
Expected behavior
The error result:
The expected result:
Reproduction link
No response
Operating System
No response
nvidia-smi output
NVCC version
nvcc: NVIDIA (R) Cuda compiler driver Copyright (c) 2005-2023 NVIDIA Corporation Built on Fri_Jan__6_16:45:21_PST_2023 Cuda compilation tools, release 12.0, V12.0.140 Build cuda_12.0.r12.0/compiler.32267302_0
The text was updated successfully, but these errors were encountered: