"Cuda By Example", Julia set example compiler errors on Jetson.

I have the “Cuda By Example” book, and I downloaded the examples from here:
http://developer.nvidia.com/object/cuda-by-example.html

When I try to compile “julia_gpu.cu” on the Jetson, I get compiler errors that look like this:
(anyone know why? How can I work around this?)

julia_gpu.cu(42): error: calling a host function(“cuComplex::cuComplex”) from a device function(“julia”) is not allowed

julia_gpu.cu(43): error: calling a host function(“cuComplex::cuComplex”) from a device function(“julia”) is not allowed

julia_gpu.cu(47): error: calling a host function(“cuComplex::cuComplex”) from a device function(“julia”) is not allowed

julia_gpu.cu(47): error: calling a host function(“cuComplex::cuComplex”) from a device function(“julia”) is not allowed

It is not a Jetson specific problem.

You should modify the line in julia_gpu.cu

cuComplex( float a, float b ) : r(a), i(b)  {}

to

__device__ cuComplex( float a, float b ) : r(a), i(b)  {}

That did it! thanks.