每天學CUDA(一): cuda的julia集執行錯誤解決辦法
阿新 • • 發佈:2019-02-16
錯誤一:
julia_gpu.cu(42): error: calling a host function("cuComplex::cuComplex") from a __device__/__global__ function("julia") is not allowed
julia_gpu.cu(43): error: calling a host function("cuComplex::cuComplex") from a __device__/__global__ function("julia") is not allowedjulia_gpu.cu(47): error: calling a host function("cuComplex::cuComplex") from a __device__/__global__ function("julia") is not allowed
julia_gpu.cu(47): error: calling a host function("cuComplex::cuComplex") from a __device__/__global__ function("julia") is not allowed
解決辦法:
這個原因是在原著中提供的程式碼有問題,原著中結構體中的程式碼為:
cuComplex(float a, float b) : r(a), i(b) {}
將其改為:
__device__ cuComplex(float a, float b) : r(a), i(b) {}
錯誤二:無法開啟檔案“glut32.lib”
把glut32.lib 以及glut64.lib拷貝到C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\lib
把glut32.dll以及glut64.dll拷貝到C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin