CUDA BY EXAMPLES一书第4章提供了一个例子,名叫“Julia Set”,我自己尝试编译运行该代码,一直报错,错误如下
1>C:/rchen/cuda_by_example/chapter04/julia_gpu.cu(44): error : calling a __host__ function("cuComplex::cuComplex") from a __device__ function("julia") is not allowed
1>C:/rchen/cuda_by_example/chapter04/julia_gpu.cu(45): error : calling a __host__ function("cuComplex::cuComplex") from a __device__ function("julia") is not allowed
1>C:/rchen/cuda_by_example/chapter04/julia_gpu.cu(32): error : calling a __host__ function("cuComplex::cuComplex") from a __device__ function("cuComplex::operator *") is not allowed
1>C:/rchen/cuda_by_example/chapter04/julia_gpu.cu(35): error : calling a __host__ function("cuComplex::cuComplex") from a __device__ function("cuComplex::operator +") is not allowed
1> julia_gpu.cu
该书提供的源代码如下所示:
<