今天下载了NVIDIA opencl官网的示例程序,没一个能运行的,于是一顿好找,最后还是谷歌给力,原因如下:
代码下载地址:https://developer.nvidia.com/opencl
报错:警告 1 warning MSB8012: TargetPath(D:\360安全浏览器下载\oclBandwidthTest\NVIDIA GPU Computing SDK\OpenCL\common\lib/Win32\oclUtils.lib) does not match the Library's OutputFile property value (D:\360安全浏览器下载\oclBandwidthTest\NVIDIA GPU Computing SDK\OpenCL\common\lib\Win32\oclUtils32D.lib). This may cause your project to build incorrectly. To correct this, please make sure that $(OutDir), $(TargetName) and $(TargetExt) property values match the value specified in %(Lib.OutputFile). C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppBuild.targets 1361 5 oclUtils
警告 2 warning MSB8012: TargetName(oclUtils) does not match the Library's OutputFile property value (oclUtils32D). This may cause your project to build incorrectly. To correct this, please make sure that $(OutDir), $(TargetName) and $(TargetExt) property values match the value specified in %(Lib.OutputFile). C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppBuild.targets 1363 5 oclUtils
错误 3 error MSB3073: 命令“mkdir ..\bin\Win32\Debug
copy ..\..\shared\bin\win32\Debug\*.dll ..\bin\Win32\Debug
copy *.bat ..\bin\Win32\Debug
:VCEnd”已退出,代码为 1。 C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppCommon.targets 132 5 oclUtils
错误 4 error C1083: 无法打开包括文件: “exception.h”: No such file or directory d:\360安全浏览器下载\oclbandwidthtest\nvidia gpu computing sdk\shared\inc\cmd_arg_reader.h 25 1 shrUtils
错误 5 error C1083: 无法打开包括文件: “exception.h”: No such file or directory d:\360安全浏览器下载\oclbandwidthtest\nvidia gpu computing sdk\shared\inc\cmd_arg_reader.h 25 1 shrUtils
错误 6 error LNK1104: 无法打开文件“shrUtils32D.lib” D:\360安全浏览器下载\oclBandwidthTest\NVIDIA GPU Computing SDK\OpenCL\src\oclBandwidthTest\LINK oclBandwidthTest
解决方案:大概主要是因为版本不对引起的,操作系统版本,cuda版本,vs版本等,具体原因是(来自该网站 https://devtalk.nvidia.com/default/topic/643590/opencl-with-latest-drivers/)I got by the problem, and thought I'd let others know how:
I re-installed the CUDA SDK (cuda_5.5.31_win8.1_general_x64.exe), since it does a force install of the included driver.
I installed the DirectX SDK for version 11 from Microsoft's site on a Windows 7 PC. I moved the missing files (d3dx9*, d3dx10*, d3dx11*) from the SDK into the VS include and lib directories on my Windows 8.1 PC. Windows 8 & 8.1 does not include the d3dx9*, d3dx10* or d3dx11* includes and libs, so the only way to get the needed files is to use the older OS. I was then able to build and run the CUDA / OpenCL examples on my Windows 8.1 PC.
懒得实践了,我还是只读代码好了