在 Ubuntu 上编译 OpenCL
我的编程经验是高中时大约 1 年的 C/C++ 经验,但几个月前我做了研究并使用 OpenCL 编写了一个简单的程序。我能够使用 g++ 和 --framework 选项相对轻松地在 Apple 计算机上编译并运行它。现在我在我的 Ubuntu 机器上,我不知道如何编译它。正确的驱动程序已与 ATI 的 Stream SDK 一起下载(我有 ATI Radeon HD5870)。任何帮助将不胜感激!
My programming experience is about 1 year of C/C++ experience from high school, but I did my research and wrote a simple program with OpenCL a few months ago. I was able to compile and run this on an Apple computer relatively easily with g++ and the --framework option. Now I'm on my Ubuntu machine and I have no idea how to compile it. The correct drivers have been downloaded along with ATI's Stream SDK (I have an ATI Radeon HD5870). Any help would be appreciated!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
尝试
如果它位于标准目录之一(很可能是 /usr/lib 或 /usr/local/lib),则需要将“--framework OpenCL”替换为“-lOpenCL”。如果 g++ 找不到该库,您可以通过添加“-L/path/to/library”告诉 g++ 在特定目录中查找。
我希望我的 Linux 能更有帮助...最好重新下载 ati-stream-sdk,解压后,打开终端并“cd /path/to/extracted/files”;在该目录中执行
make && sudo make install
make
你可能从windows就知道这个,这个编译,需要编译什么&&
将命令链接在一起,下面的命令只会如果第一个命令成功,则执行sudo make install
这会将文件放在预期的位置(sudo 使用超级用户权限执行命令,您必须输入密码)希望有所帮助。
Try
If it is in one of the standard directories (most likely /usr/lib, or /usr/local/lib) you need to replace "--framework OpenCL" with "-lOpenCL". If g++ cannot find the lib you can tell g++ to look in a specific directory by adding "-L/path/to/library".
I wish I had my Linux to be more helpful... It is probably best if you redownload the ati-stream-sdk, after extracting it, open the Terminal and "cd /path/to/extracted/files"; in that directory execute
make && sudo make install
make
you probably know this from windows, this compiles, whatever needs to be compiled&&
chains commands together, the following commands will only be executed if the first command succeededsudo make install
this will put the files in the expected places (sudo executes a command with superuser priviledges, you will have to enter your password)Hope that helps.
您可能缺少动态链接器配置中的动态库。
搜索图书馆在哪里。最有可能的是 /usr/lib 或 /usr/local/lib。
确保路径位置也配置在以下位置之一:
You might be missing the dynamic libraries from the dynamic linker configuration.
Search for where the libraries are. Most likely /usr/lib, or /usr/local/lib.
Make sure the path location is also configured at one of these places:
原因
除了@bjoernz,我的系统找不到
libOpenCL.so
文件这是因为缺少正确的文件目录
经过互联网搜索后,我发现
libOpenCL.so
code> 文件可以由ocl-icd-opencl-dev
软件包提供解决方案
只需要在 cmd 中输入安装上述软件包即可
,因此可以找到
libOpenCL.so
在/usr/lib/x86_64-linux-gnu/
文件夹下我的系统信息
参考:
[1] 如何在ubuntu上安装libOpenCL.so
[2] 如何在 Linux 中设置 OpenCL
Reason
Aside from @bjoernz, my system can't find the
libOpenCL.so
fileIt's because the correct file directory is missing
After searchig over the internet, I found out that
libOpenCL.so
file can provided byocl-icd-opencl-dev
packageSolution
You just need to install the package mentioned above by typing into cmd
Therefore,
libOpenCL.so
can be found under/usr/lib/x86_64-linux-gnu/
folderMy System Information
Reference:
[1] How to install libOpenCL.so on ubuntu
[2] How to set up OpenCL in Linux