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

StackOverflow https://stackoverflow.com//questions/10707284

  •  13-12-2019
  •  | 
  •  

Вопрос

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.

Это было полезно?

Решение

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.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top