简体   繁体   English

无法链接AMD SDK opencl

[英]Trouble linking AMD SDK opencl

I am having serious trouble taking my first steps in Opencl, primarily because my compiler either refuses to recognize the existence of the relevant libraries. 我在Opencl迈出第一步时遇到了严重的麻烦,主要是因为我的编译器拒绝识别相关库的存在。 I downloaded the latest version of the AMD SDK from their website and went with the full install. 我从他们的网站下载了最新版本的AMD SDK,并进行了完整安装。 I'm wanting to learn through this blog , so much of my information is derived from there. 我想通过这个博客学习,所以我的很多信息都来自那里。

First off, I've checked my system path variable and it has the 64 bit bin folder of the amd api included. 首先,我检查了系统路径变量,它包含了amd api的64位bin文件夹。

I started off trying to compile using a make file with the apparently standard option -lOpenCl but it simply told me that it could not find -lOpenCl or CL\\cl.hpp. 我开始尝试使用带有标准选项-lOpenCl的make文件进行编译,但它只是告诉我找不到-lOpenCl或CL \\ cl.hpp。 So I then added -I %AMDAPPSDKROOT%\\include which fixed half my problem, yet still (three hours and counting) the compiler complains about undefined references while refusing to recognize any of the relevant libraries. 因此,我然后添加了-I %AMDAPPSDKROOT%\\include ,它解决了我一半的问题,但是仍然(三个小时,并且不断增加),编译器在拒绝识别任何相关库的同时抱怨未定义的引用。

g++ -std=c++1y -g -o .\\bin\\test.exe .\\quicktest.cpp -I .\\Libraries -I .\\Scource -I "%AMDAPPSDKROOT%\\include" -L "%AMDAPPSDKROOT%\\bin\\x86_64" -L "%AMDAPPSDKROOT%\\lib\\x86_64" -LlibOpenCl.a is the command I am compiling with right now, and it has vanquished all issues but the undefined references to functions like clGetPlatform and clReleaseCommandQueue . g++ -std=c++1y -g -o .\\bin\\test.exe .\\quicktest.cpp -I .\\Libraries -I .\\Scource -I "%AMDAPPSDKROOT%\\include" -L "%AMDAPPSDKROOT%\\bin\\x86_64" -L "%AMDAPPSDKROOT%\\lib\\x86_64" -LlibOpenCl.a是我现在正在编译的命令,它已解决了所有问题,但对诸如clGetPlatformclReleaseCommandQueue类的函数的未定义引用。 I am using the exact same code as the first example in the OpenCl blog except I've also included vector . 我使用与OpenCl博客中第一个示例完全相同的代码,除了我还包括vector

I've tried a load of different combinations, and suggestions from the internet but nothing has worked so far. 我尝试了很多不同的组合,并从互联网上获得了建议,但到目前为止没有任何效果。 Is there something I am missing / don't understand? 有什么我想念的/不理解的吗? I would really like to move ahead with my learning and would deeply appreciate any help. 我真的很想继续学习,并深表感谢。

To be honest, I do not know exactly what information would be helpful, but if it helps I am running a 64 bit windows 7 computer with a Geforce GT 635 and I have both CUDA and the AMD SDK installed. 老实说,我不知道确切的信息会有所帮助,但是如果有帮助,我将运行带有Geforce GT 635的64位Windows 7计算机,并且同时安装了CUDA和AMD SDK。

looking at how you are compiling it seems that -LlibOpenCl.a is wrong. 查看您的编译方式,似乎-LlibOpenCl.a错误。 -L is used for library directories while -l is used for single libraries. -L用于库目录,而-l用于单个库。 To use -l you have to remove the lib in front of the library name and remove whats after the dot. 要使用-l,您必须删除库名前面的lib并删除点后的内容。 In your case it should be -lOpenCl as you stated at the beginning. 在您的情况下,应如开头所述是-lOpenCl。

Is libOpenCl in one of these two directories ? libOpenCl在这两个目录之一中吗? : %AMDAPPSDKROOT%\\bin\\x86_64 %AMDAPPSDKROOT%\\lib\\x86_64 :%AMDAPPSDKROOT%\\ bin \\ x86_64%AMDAPPSDKROOT%\\ lib \\ x86_64

I suppose the first one is for the binaries and he second one for the libraries so the first one should be useless. 我想第一个用于二进制文件,第二个用于库文件,因此第一个应该没有用。 You get undefined references during linking since you are still not linking the library. 由于仍未链接库,因此在链接过程中会得到未定义的引用。

g++ -std=c++1y -g -o .\bin\test.exe .\quicktest.cpp -I .\Libraries
-I .\Scource -I "%AMDAPPSDKROOT%\include" "%AMDAPPSDKROOT%\lib\x86\libOpenCl.a"

%AMDAPPSDKROOT%\\lib\\x86\\libOpenCl.a by specifying the full file path and including the file with the same semantics as if it were an object file I got my project to compile, I also used the 32 bit version of the libraries instead of the 64 bit version. %AMDAPPSDKROOT%\\lib\\x86\\libOpenCl.a是指定完整的文件路径,并包括具有与我要编译的目标文件相同的语义的文件,我还使用了32位版本的库来代替64位版本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM