问题
As the title suggests, I have copied verbatim the hello.cl
and hello.c
files from Fixstar's online OpenCL book, at http://www.fixstars.com/en/opencl/book/OpenCLProgrammingBook/first-opencl-program.html, and cannot get correct output.
I compile the program using
gcc -lOpenCL hello.c -o hello
.
I execute normally with
./hello
.
But my output reads something like ���.
I run Arch Linux and have installed OpenCL, the headers, and the NVIDIA implementation. I would like to continue learning OpenCL but simply cannot continue if my programs won't run. Does anyone have any ideas on what is occuring? Additionally, if anyone has any advice on how to debug this I would be immensely happy.
EDIT: I was using Nouveau drivers instead of the Nvidia ones. Nouveau does not support OpenCL. This was the problem.
回答1:
Nouveau does NOT support OpenCL yet. Replace nouveau with nvidia and check to make sure libcl
, libcl-headers
, and opencl-nvidia
are all correctly installed.
来源:https://stackoverflow.com/questions/10707284/opencl-simple-hello-world-program-compiles-correctly-but-spits-out-garbage-wh