📅 2013-Oct-10 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ abs, cuda, error ⬩ 📚 Archive
Problem
This was CUDA code that compiled without errors on Windows. But, when compiled on Linux, it gave this error:
foobar.cu(36): error: calling a __host__ function("std::abs<short> ") from a __global__ function("kernelHelloWorld") is not allowed
The line in the kernelHelloWorld
which caused the error was something like this:
short s = abs(getMeAFloat());
Solution
Finding no solution to this, I changed the abs
to fabsf
, which is supported in CUDA:
short s = fabsf(getMeAFloat());
Tried with: CUDA 5.5 and Ubuntu 12.04 LTS