CMAke无法通过NVIDA找到opencl sdk [英] CMAke can not find opencl sdk by NVIDA
问题描述
我刚刚安装了NVIDA CUDA工具包,用于在Windows 8.1上开发OpenCL应用程序.
I just installed NVIDA CUDA tool kit to use it for developing OpenCL application on windows 8.1.
我来解决一些问题:
1- FinedOpenCl.cmake无效,因为nvida工具包未设置opencl_dir.
1- FinedOpenCl.cmake doesn't work since opencl_dir is not set by nvida tool kit.
cmake文件为:
FIND_PACKAGE(OpenCL REQUIRED)
INCLUDE_DIRECTORIES(${OPENCL_INCLUDE_DIR})
和cmake错误是:
CMake Error at C:/Program Files (x86)/CMake/share/cmake-3.1/Modules/FindPackageHandleStandardArgs.cmake:138 (message):
Could NOT find OpenCL (missing: OPENCL_LIBRARY OPENCL_INCLUDE_DIR)
Call Stack (most recent call first):
C:/Program Files (x86)/CMake/share/cmake-3.1/Modules/FindPackageHandleStandardArgs.cmake:374 (_FPHSA_FAILURE_MESSAGE)
cmake/FindOpenCL.cmake:35 (find_package_handle_standard_args)
CMakeLists.txt:5 (FIND_PACKAGE)
2- c ++接口没有cl.hpp.
2- There is no cl.hpp for c++ interface.
3-标头和库位于不同的目录中,因此很难在应用程序中使用它们.
3- Headers and libraries are on different directories and hence it is difficult to use them with application.
我的问题:
1-有什么我可以解决的吗?
1- Is there anything that I can do to solve them?
2-设置过程中是否有任何选项可以自动进行所需的设置.
2- Is there any option during setup that do the required setting automatically.
推荐答案
您可以使用其他-D
选项运行cmake
,例如:
You can run cmake
with additional -D
options, like:
cmake [some_your_options] -DOpenCL_LIBRARY=/cygdrive/c/cuda/lib -DOpenCL_INCLUDE_DIR=/cygdrive/c/cuda/include [some_your_other_options] .....
因此它将看到OpenCL,例如手动指定的路径.
So it will see OpenCL such manually specified paths.
为我的 CygWin64 提供的上一个示例,其中在C:\cygdrive
文件夹中,我之前为所有必需的逻辑驱动器添加了mklink
的几个符号链接,因此"c"
链接至"C:\"
, "d"
链接到"D:\"
,依此类推.
Upper example provided for my CygWin64, where in the folder C:\cygdrive
I added several symbolic links by mklink
for all needed logical drives before, so "c"
links to "C:\"
, "d"
links to "D:\"
and so on.
我的NVidia CUDA安装路径确实是C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0\
,但是它不是很方便,因此我也在C:
上命名为"cuda"的符号链接(mklink /D linkname "path"
),所以/cygdrive/c/cuda/lib
确实指向
My NVidia CUDA install path is really C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0\
, but it is not very handy, so I also maked symlink (mklink /D linkname "path"
) on C:
named "cuda", so /cygdrive/c/cuda/lib
is really points to C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0\lib
.
在Windows上模拟Unix环境并在命令promt中进行编译非常棘手,是的.
Unix environment emulation on windows and compiling in command promt is very tricky, yes..
这篇关于CMAke无法通过NVIDA找到opencl sdk的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!