-
Notifications
You must be signed in to change notification settings - Fork 93
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
Add custom thrust/cub namespace when it is supported #1730
Conversation
07ed9a8
to
3bfdc5e
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #1730 +/- ##
===========================================
- Coverage 90.94% 89.57% -1.38%
===========================================
Files 782 782
Lines 63297 63527 +230
===========================================
- Hits 57564 56902 -662
- Misses 5733 6625 +892 ☔ View full report in Codecov by Sentry. 🚨 Try these New Features:
|
CMakeLists.txt
Outdated
option(GINKGO_CUDA_CUSTOM_THRUST_NAMESPACE "Add custom namespace to thrust and cub in cuda to avoid potential break when the other libraries also uses thrust" OFF) | ||
option(GINKGO_HIP_CUSTOM_THRUST_NAMESPACE "Add custom namespace to thrust in hip to avoid potential break when the other libraries also uses thrust" OFF) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO we should always enable this if it is supported by the Thrust/rocThrust version we found. If we disable it by default, it may break people's code, I don't see a downside to enabling it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, minor fix: "when the other libraries also uses thrust" --> "when the other libraries also use thrust". And maybe instead of "break", we should say "conflicts"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not too confident about all thrust version always properly respect the custom namespace
like cccl inline issue from host compiler and rocThrust only implement it in half way for several versions.
I think enabling them by default but facing some compiling issue then user turn it off, which is somehow better than hanging somewhere else then taking long time to acknoledge the issue actually from thrust in my mind now.
3bfdc5e
to
96c9796
Compare
…ct or not-full-support
Co-authored-by: Tobias Ribizel <ribizel@kit.edu> Co-authored-by: Natalie Beams <246972+nbeams@users.noreply.github.com>
96c9796
to
c809aea
Compare
cecf2a0
to
96233a2
Compare
Co-authored-by: Tobias Ribizel <ribizel@kit.edu>
96233a2
to
b85680c
Compare
|
…supported This PR adds custom thrust namespace for hip and cuda when it is supported to reduce the potential conflict by thrust itself. Hip enables it after 5.7 and cuda enable it after 11.6 Related PR: ginkgo-project#1730
This PR allows ginkgo to add custom namespace wrapper around thrust and cub.
We had the issue that ginkgo-alone perform correctly, but some thrust routine is hanging when linking with the other libraries also using thrust.
Ths similar experience had described in NVIDIA/cub#545
Some similar issues may be solved when the thrust is 1.17.2 or 2.1+ (NVIDIA/cub#572), which embeds all architecture in the namespace.
We always use thrust shipped from the cuda Toolkit, and cuda 11.6 (11.6.2 uses thrust 1.15) starts to accept the
THRUST_CUB_WRAPPED_NAMESPACE
I put it as gko such that we do not need to use
THRUST_NS_QUALIFIER
as namespace, which is not defined before supporting custom namespace.if we need to forward declare something without thrust header, we will need to add ginkgo macro to help that. (currently not neccessary)
Also, when thrust is shipped by CCCL, there is an issue missing inline with host compiler from NVIDIA/cccl#1922.
when using host compiler to compile thrust with custom namespace, it may lead
cub::Debug
multiple symbols or definition. It does not face the issue without custom namespace though. I avoid them now by ensuring executor.cpp does not include thrust header.We enable it when the custom namespace supported