Closed fwyzard closed 4 years ago
I forgot to add that I am using the devel
branch of Alpaka and the dev
branch of Cupla.
From a quick look at the code, I guess the reason is that in include/cupla/cudaToCupla/runtime.hpp cudaGetLastError()
is #define
d to cuplaGetLastError()
:
#define cudaGetLastError(...) cuplaGetLastError(__VA_ARGS__)
and in src/common.cpp cuplaGetLastError()
calls cudaGetLastError()
:
CUPLA_HEADER_ONLY_FUNC_SPEC
cuplaError_t
cuplaGetLastError()
{
#if( ALPAKA_ACC_GPU_CUDA_ENABLED == 1 )
// reset the last cuda error
return (cuplaError_t)cudaGetLastError();
#elif( ALPAKA_ACC_GPU_HIP_ENABLED == 1 )
return (cuplaError_t)hipGetLastError();
#else
return cuplaSuccess;
#endif
}
which means it calls itself indefinitely.
@waredjeb FYI
thanks for the report, the bug is fixed with #139.
Calling
cudaGetLastError()
results while using Cupla in header-only mode in an infinite loop.test.cc
Build and run with
The program gets stuck on line 6, and it never reaches the
std::cout
statement.Removing the
#include <cupla/config/GpuCudaRt.hpp>
and running with CUDA natively works, as expected.