-
Notifications
You must be signed in to change notification settings - Fork 75
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
very simple kernel fails to compile #2448
Comments
Any suggestions how to fix the alpaka 1.2.0 code to make it work ? |
I copied the code over an example and it is compiled with alpaka_ACC_GPU_CUDA_ENABLE and and alpaka_ACC_GPU_CUDA_ONLY cmake vars were ON with different compilers so issue is related to HOST_ONLY setting. |
The problem is most likely a missing include due to the usage of |
OK the header check is not helping. The root of the problem is that |
OK IMO this issue is not a bug and the user code must be fixed. From the PR @fwyzard implemented in the past #1567 the definition of
Following this the example above must be changed to #include <alpaka/alpaka.hpp>
using Idx = uint32_t;
using Dim1D = alpaka::DimInt<1u>;
#ifndef(ALPAKA_HOST_ONLY)
class Kernel {
public:
ALPAKA_FN_ACC void operator()(alpaka::AccGpuCudaRt<Dim1D, Idx> const &acc) const {
alpaka::getIdx<alpaka::Grid, alpaka::Threads>(acc);
}
};
#endif using concepts or as in the following example enabling if should work too but looks extremely boring: #include <alpaka/alpaka.hpp>
#include <type_traits>
using Idx = uint32_t;
using Dim1D = alpaka::DimInt<1u>;
class Kernel
{
public:
template<typename T_Acc>
ALPAKA_FN_ACC auto operator()(T_Acc const& acc) const -> std::enable_if_t<
std::is_same_v<alpaka::AccToTag<T_Acc>, alpaka::TagGpuCudaRt> && std::is_same_v<alpaka::Dim<T_Acc>, Dim1D>
&& std::is_same_v<alpaka::Idx<T_Acc>, Idx>>
{
alpaka::getIdx<alpaka::Grid, alpaka::Threads>(acc);
}
}; |
@psychocoderHPC thanks for looking into this, I think you are right about the example being wrong. I will check if the problem is in my small reproducer or in the original code. |
@psychocoderHPC it is indeed our original code that is incorrect: the alpaka kernels are included in a file that should be "host-only", so the failure is indeed expected. |
Do you think there may be a way to detect when it happens and issue a more explanatory error message ? For example, if
then |
P.S. I have no idea why compiling with |
This embarrassingly simple program
fails to compile with clang 18.1, alpaka 1.2.0, boost 1.80 and cuda 12.4, when doing a host-only compilation while targetting the CUDA backend:
gives
The text was updated successfully, but these errors were encountered: