-
Notifications
You must be signed in to change notification settings - Fork 66
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
Overzealously defining __device__ functions when compiling with nvcc #209
Comments
This is not a Fusion specific issue; |
I will gladly file an issue there, but I don't agree that there is no Fusion specific issue. Granted other modules probably do things wrong as well, because the whole strategy is brittle, but that doesn't change the fact that Fusion is doing things incorrectly as well. Config is correctly determining that we are compiling a Adding |
OK, but I don't know which functions are valid or invalid. So, PR is very welcome. |
I'm not entirely sure if this issue belongs here or on the boost umbrella project. The actual error I'm facing could be argued to originate either in boost::fusion or in boost::accumulators, but the overall strategy boost employs to support cuda is brittle to begin with. The overarching problem is that portions of boost cannot be used in
.cu
files even if they are not going to be used in actual device code. This is entirely due to how the sections of boost that support cuda attempt to do so, not due to any intrinsic limitations of host side code in a.cu
file.The crux my particular issue is that boost fusion seems to mark many (or all?) functions with
BOOST_FUSION_GPU_ENABLED
, which gets it's value fromBOOST_GPU_ENABLED
, which has the value of__host__ __device__
when compiling with nvcc (and empty otherwise). This is problematic because this library is heavily templated, and you cannot call a__host__
only function from a__host__ __device__
function. Boost fusion calls functions it has no control over (injected via templates), and if any of those functions are not decorated with__host__ __device__
then there will be problems. Even if the end user code is only going to invoke the host side call paths, the mere attempt to define the ill-formed device side call paths causes errors.A minimal example is included below. It's a trivial cuda program that doesn't even call any GPU code. The mere fact that if you compile it with nvcc, boost::fusion will try and define device functions that call host-only boost::accumulator code. This makes it impossible to use portions of boost code in .cu files, even in portions of the code that will only ever be run on the host.
I can save the following code as "main.cu", and compile with
nvcc
version 10.0.117 on Ubuntu 18.04. The result is a lot of compilation errors about "identifier is undefined in device code". If hack things and redefineBOOST_GPU_ENABLED
to be just__host__
then there are no compilation issues.The text was updated successfully, but these errors were encountered: