OpenCL Simple “Hello World!” program compiles correctly but spits out garbage when executed

若如初见. 提交于 2019-12-08 04:16:22

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!