但执行时会吐出垃圾

但执行时会吐出垃圾

本文介绍了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.

I compile the program using gcc -lOpenCL hello.c -o hello.

我正常执行 ./hello.

I execute normally with ./hello.

但是我的输出显示类似 .

But my output reads something like ���.

我运行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.将nuveau替换为nvidia,并检查以确保正确安装了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!"程序正确编译,但执行时会吐出垃圾的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-13 12:14