Hello,
I am trying to run the program julia_gpu.cu (chapter04). However, I am getting following error message
usr@usr-OEM:~/Desktop/usr/cuda_by_example/chapter04$ nvcc -lglut julia_gpu.cu
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 allowed
julia_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
4 errors detected in the compilation of “/tmp/tmpxft_00002a4c_00000000-4_julia_gpu.cpp1.ii”.
I will be grateful if someone assists me in solving this issue. I am using Ubuntu 11.04 and have installed CUDA TOOLKIT 4.0.
I had the same problem, but when I add “device” and compiling the code it turn out
giordi@giordi-PC:~/CUDA/Programmi$ nvcc 04-02-02-GPU.cu
/tmp/tmpxft_00000e7a_00000000-13_04-02-02-GPU.o: In function `CPUBitmap::display_and_exit(void (*)(void*))':
tmpxft_00000e7a_00000000-1_04-02-02-GPU.cudafe1.cpp:(.text._ZN9CPUBitmap16display_and_exitEPFvPvE[CPUBitmap::display_and_exit(void (*)(void*))]+0x4e): undefined reference to `glutInit'
tmpxft_00000e7a_00000000-1_04-02-02-GPU.cudafe1.cpp:(.text._ZN9CPUBitmap16display_and_exitEPFvPvE[CPUBitmap::display_and_exit(void (*)(void*))]+0x58): undefined reference to `glutInitDisplayMode'
tmpxft_00000e7a_00000000-1_04-02-02-GPU.cudafe1.cpp:(.text._ZN9CPUBitmap16display_and_exitEPFvPvE[CPUBitmap::display_and_exit(void (*)(void*))]+0x6f): undefined reference to `glutInitWindowSize'
tmpxft_00000e7a_00000000-1_04-02-02-GPU.cudafe1.cpp:(.text._ZN9CPUBitmap16display_and_exitEPFvPvE[CPUBitmap::display_and_exit(void (*)(void*))]+0x79): undefined reference to `glutCreateWindow'
tmpxft_00000e7a_00000000-1_04-02-02-GPU.cudafe1.cpp:(.text._ZN9CPUBitmap16display_and_exitEPFvPvE[CPUBitmap::display_and_exit(void (*)(void*))]+0x83): undefined reference to `glutKeyboardFunc'
tmpxft_00000e7a_00000000-1_04-02-02-GPU.cudafe1.cpp:(.text._ZN9CPUBitmap16display_and_exitEPFvPvE[CPUBitmap::display_and_exit(void (*)(void*))]+0x8d): undefined reference to `glutDisplayFunc'
tmpxft_00000e7a_00000000-1_04-02-02-GPU.cudafe1.cpp:(.text._ZN9CPUBitmap16display_and_exitEPFvPvE[CPUBitmap::display_and_exit(void (*)(void*))]+0x92): undefined reference to `glutMainLoop'
/tmp/tmpxft_00000e7a_00000000-13_04-02-02-GPU.o: In function `CPUBitmap::Draw()':
tmpxft_00000e7a_00000000-1_04-02-02-GPU.cudafe1.cpp:(.text._ZN9CPUBitmap4DrawEv[CPUBitmap::Draw()]+0x26): undefined reference to `glClearColor'
tmpxft_00000e7a_00000000-1_04-02-02-GPU.cudafe1.cpp:(.text._ZN9CPUBitmap4DrawEv[CPUBitmap::Draw()]+0x30): undefined reference to `glClear'
tmpxft_00000e7a_00000000-1_04-02-02-GPU.cudafe1.cpp:(.text._ZN9CPUBitmap4DrawEv[CPUBitmap::Draw()]+0x59): undefined reference to `glDrawPixels'
tmpxft_00000e7a_00000000-1_04-02-02-GPU.cudafe1.cpp:(.text._ZN9CPUBitmap4DrawEv[CPUBitmap::Draw()]+0x5e): undefined reference to `glFlush'
collect2: ld returned 1 exit status
/* On Linux, include the system’s copy of glut.h, glext.h, and glx.h */ #include
second one is in the julia_gpu.cu
// cuComplex( float a, float b ) : r(a), i(b) {} device cuComplex( float a, float b ) : r(a), i(b) {}
However, when the exe file is called I get only a frozen screen which is the same with the one given in the book. Animation does not work. Why can it be so ?