Fix CUB compilation errors with CUDA 12.x by removing namespace wrapping#237
Open
ZhuYanzhen1 wants to merge 1 commit into
Open
Fix CUB compilation errors with CUDA 12.x by removing namespace wrapping#237ZhuYanzhen1 wants to merge 1 commit into
ZhuYanzhen1 wants to merge 1 commit into
Conversation
…ibility issues when using CUDA 12.4.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When compiling DREAMPlace with CUDA 12.x, the build fails with numerous errors from CUB headers such as
agent_three_way_partition.cuhandtuning_three_way_partition.cuh. Example errors include:Root Cause
The issue stems from two sources:
Namespace wrapping incompatibility: The project's
utils_cub.cuhheader wraps CUB includes withCUB_NS_PREFIX/CUB_NS_POSTFIXmacros to place CUB inside theDreamPlacenamespace. This technique was compatible with older CUB versions but breaks with CUDA 11+ where CUB uses thecuda::stdnamespace internally, which cannot be wrapped.Potential version conflict: For CUDA 11+, the system CUB should be used exclusively, but the build configuration did not properly exclude the bundled old CUB (v1.8.0 from 2018) from include paths.
Solution
Modified
dreamplace/ops/utility/src/utils_cub.cuh: Added conditional compilation to skip namespace wrapping for CUDA 11+. For CUDA 11+, we include the system CUB directly and create a namespace alias for compatibility. For CUDA 10 and below, we continue using the bundled CUB with namespace wrapping.Modified
CMakeLists.txt: Enhanced the CUB configuration to explicitly exclude the bundled CUB fromCMAKE_PREFIX_PATHwhen using CUDA 11+, preventing accidental inclusion of the old CUB headers.