OpenCL 简单的“Hello World!"程序编译正确,但在执行时吐出垃圾 [英] OpenCL Simple "Hello World!" program compiles correctly but spits out garbage when executed

查看:46
本文介绍了OpenCL 简单的“Hello World!"程序编译正确,但在执行时吐出垃圾的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

正如标题所暗示的,我已经逐字复制了 Fixstar 的在线 OpenCL 书籍中的 hello.clhello.c 文件,位于 http://www.fixstars.com/en/opencl/book/OpenCLProgrammingBook/first-opencl-program.html,无法得到正确的输出.

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.

我编译程序使用gcc -lOpenCL hello.c -o hello.

我正常执行./hello.

但我的输出类似于.

我运行 Arch Linux 并安装了 OpenCL、头文件和 NVIDIA 实现.我想继续学习 OpenCL,但如果我的程序无法运行,就无法继续学习.有没有人对正在发生的事情有任何想法?此外,如果有人对如何调试有任何建议,我会非常高兴.

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.

我使用的是 Nouveau 驱动程序而不是 Nvidia 驱动程序.Nouveau 不支持 OpenCL.这就是问题所在.

I was using Nouveau drivers instead of the Nvidia ones. Nouveau does not support OpenCL. This was the problem.

推荐答案

Nouveau 尚不支持 OpenCL.用 nvidia 替换 nouveau 并检查以确保 libcllibcl-headersopencl-nvidia 都已正确安装.

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.

这篇关于OpenCL 简单的“Hello World!"程序编译正确,但在执行时吐出垃圾的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆