gpuDevice()工具包版本总是5.5 [英] gpuDevice() toolkit version always 5.5
问题描述
无论我如何重新安装CUDA驱动程序和工具包,在键入gpuDevice()时,它总是显示:
CUDADevice具有属性:
名称:'Quadro K2000M'
索引:1
ComputeCapability:'3.0'
SupportsDouble:1
DriverVersion:6.5000
ToolkitVersion:5.5000
MaxThreadsPerBlock:1024
MaxShmemPerBlock:49152
MaxThreadBlockSize:1024×1024 64]
MaxGridSize:2.1475e + 09 65535 65535]
SIMDWidth:32
TotalMemory:2.1475e + 09
FreeMemory:2.0431e + 09
MultiprocessorCount:2
ClockRateKHz:745000
ComputeMode:默认
GPUOverlapsTransfers:1
KernelExecutionTimeout:0
CanMapHostMemory:1
DeviceSupported:1
DeviceSelected:1
这我不明白。为什么工具包版本总是5.5?我可以升级到6.5吗?
我不明白为什么这个问题得到投票。这是我在MEX尝试使用CUDA时的第一个问题。
正如@Robert所说,你必须使用相同的cuda版本,但不一定如果你使用简单的技巧(我使用CUDA 6.0和MATLAB CUDA版本是5.0)。要使它工作,你不需要复杂的过程,也不需要 mex
来编译所有 .cu
文件和复制xml文件(如在链接中)到目录编译。在matlab命令中键入以下两行:
!nvcc -O3 -DNDEBUG -c mexGPUExample.cu -Xcompiler -fPIC -I / MATLAB_ROOT / extern / include -I / MATLAB_ROOT / toolbox / distcomp / gpu / extern / include;
mex mexGPUExample.o -L / usr / local / cuda-6.0 / lib64 -L / MATLAB_ROOT / bin / glnxa64 -lcudart -lcufft -lmwgpu
然后,即使你的ToolkitVersion不匹配,它将神奇地工作。 (更改/ MATLAB_ROOT到你的matlab根路径)
为什么MATLAB CUDA Toolkit版本不同于CUDA版本? h2>
关于您的问题,安装的CUDA版本与MATLAB使用的CUDA版本不同。
如果您转到
/ matlabroot / bin / maci64 OS X)
/ matlabroot / bin / glnxa64(unix variant)
,
你可以看到[动态链接库,共享库]
libcudart.5.5 [dylib,so]
libcublas.5.5。[dylib,so]
libcufft.5.5。[dylib,so]
这些是MATLAB使用的库。要使matlab使用系统库,请按照以下说明。 (仅MAC)
总而言之,
- 安装的cuda版本不同来自MATLAB cuda,因为他们有自己的库
- 要欺骗它加载新的库,您可能需要使用
install_name_tool
-
- b
$ b编辑:如何使MATLAB使用系统CUDA库(OS X)
使MATLAB使用系统CUDA库, MATLAB CUDA库版本是5.5,如果要使用最新的库,请阅读以下
:
- 转到
/Applications/MATLAB_R2014a.app/bin/maci64
(MAC)或MATLAB_ROOT / bin / glxna64
(LINUX) -
查看
libmwgpu的库依赖性。[dylib,so]
这是使用CUDA时加载的条目库
结果看起来像
dnab404675:maci64 user $ otool -L libmwgpu.dylib
libmwgpu.dylib:
@ rpath / libmwgpu.dylib(兼容性版本0.0.0,当前版本0.0.0)
....有些库
@ rpath / libcublas.5.5.dylib(兼容版本5.5.0,当前版本5.5.20)
@ rpath / libcudart.5.5.dylib兼容性版本5.5.0,当前版本5.5.20)
@ rpath / libcufft.5.5.dylib(兼容性版本5.5.0,当前版本5.5.20)
... and more
我们的目标是修改
cublas
,cudart
,cufft
至
/usr/local/cuda/lib/libcublas.dylib(兼容性版本5.5.0,当前版本5.5.20)
/usr/local/cuda/lib/libcudart.dylib(兼容性版本5.5.0,当前版本5.5.20)
/usr/local/cuda/lib/libcufft.dylib(兼容性版本5.5.0,当前版本5.5.20)
请注意,如果你键入gpuDevice,它仍然会显示为工具包版本5.但它加载新版本。
sudo install_name_tool -change @ rpath / libcufft.5.5.dylib /usr/local/cuda/lib/libcufft.dylib libmwgpu.dylib
sudo install_name_tool -change @ rpath / libcudart.5.5 .dylib /usr/local/cuda/lib/libcudart.dylib libmwgpu.dylib
sudo install_name_tool -change @ rpath / libcublas.5.5.dylib / usr / local / cuda /lib/libcublas.dylib libmwgpu.dylib
我还是不知道如何更改Linux中的共享库路径。可能必须使用十六进制编辑器,例如 HT 从 Stackoverflow Answer
No matter how I reinstall the CUDA driver and toolkit, when typing gpuDevice(), it always show s:
CUDADevice with properties: Name: 'Quadro K2000M' Index: 1 ComputeCapability: '3.0' SupportsDouble: 1 DriverVersion: 6.5000 ToolkitVersion: 5.5000 MaxThreadsPerBlock: 1024 MaxShmemPerBlock: 49152 MaxThreadBlockSize: [1024 1024 64] MaxGridSize: [2.1475e+09 65535 65535] SIMDWidth: 32 TotalMemory: 2.1475e+09 FreeMemory: 2.0431e+09 MultiprocessorCount: 2 ClockRateKHz: 745000 ComputeMode: 'Default' GPUOverlapsTransfers: 1 KernelExecutionTimeout: 0 CanMapHostMemory: 1 DeviceSupported: 1 DeviceSelected: 1
which I don't understand. Why the toolkit version is always 5.5? Can I upgrade it to 6.5?
解决方案I do not see why this question gets down vote. This is the first question that I had in mind when I try to use CUDA in MEX.
As @Robert mentioned, you have to use the same cuda version but not necessarily if you use simple trick (I'm using CUDA 6.0 and MATLAB CUDA version is 5.0). To make it work, you do not need the complicated procedure, nor the
mex
for compiling all.cu
files and copying the xml file ( as in Link) to the directory to compile. Type simply the following two lines in the matlab command,!nvcc -O3 -DNDEBUG -c mexGPUExample.cu -Xcompiler -fPIC -I/MATLAB_ROOT/extern/include -I/MATLAB_ROOT/toolbox/distcomp/gpu/extern/include; mex mexGPUExample.o -L/usr/local/cuda-6.0/lib64 -L/MATLAB_ROOT/bin/glnxa64 -lcudart -lcufft -lmwgpu
Then it will magically work even if your ToolkitVersion mismatches. (Change /MATLAB_ROOT to your matlab root path)
Why MATLAB CUDA Toolkit version is different from System CUDA version?
Regarding your question, the installed CUDA version is not the same CUDA that MATLAB use.
If you go to
/matlabroot/bin/maci64 (OS X) /matlabroot/bin/glnxa64 (unix variant)
depending on your os, you can see the [dynamic linking library, shared library]
libcudart.5.5.[dylib, so] libcublas.5.5.[dylib, so] libcufft.5.5.[dylib, so]
These are the libraries that MATLAB uses. To make matlab to use system libraries, follow the instructions below. (MAC only)
In sum,
- The installed cuda version is different from MATLAB cuda since they have their own library
- To trick it to load the new library, you might need to use
install_name_tool
to change the library link - Anyway you don't need it to have same version.
EDIT : How to make MATLAB to use System CUDA Library (OS X)
Make MATLAB to use System CUDA library, The default MATLAB CUDA library version is 5.5 and if you want to use the up-to-date library, read the following
- Go to
/Applications/MATLAB_R2014a.app/bin/maci64
(MAC) orMATLAB_ROOT/bin/glxna64
(LINUX) See the library dependencies of
libmwgpu.[dylib, so]
this is the entry library that is loaded when you use CUDAThe result would look like
dnab404675:maci64 user$ otool -L libmwgpu.dylib libmwgpu.dylib: @rpath/libmwgpu.dylib (compatibility version 0.0.0, current version 0.0.0)
.... Some Libraries
@rpath/libcublas.5.5.dylib (compatibility version 5.5.0, current version 5.5.20) @rpath/libcudart.5.5.dylib (compatibility version 5.5.0, current version 5.5.20) @rpath/libcufft.5.5.dylib (compatibility version 5.5.0, current version 5.5.20)
... and more
Our goal is to modify the library dependency of
cublas
,cudart
,cufft
to/usr/local/cuda/lib/libcublas.dylib (compatibility version 5.5.0, current version 5.5.20) /usr/local/cuda/lib/libcudart.dylib (compatibility version 5.5.0, current version 5.5.20) /usr/local/cuda/lib/libcufft.dylib (compatibility version 5.5.0, current version 5.5.20)
Note that if you type gpuDevice, it will still show it as toolkit version 5. But it loads the new version. So how we do that?
Simply type
sudo install_name_tool -change @rpath/libcufft.5.5.dylib /usr/local/cuda/lib/libcufft.dylib libmwgpu.dylib
sudo install_name_tool -change @rpath/libcudart.5.5.dylib /usr/local/cuda/lib/libcudart.dylib libmwgpu.dylib
sudo install_name_tool -change @rpath/libcublas.5.5.dylib /usr/local/cuda/lib/libcublas.dylib libmwgpu.dylib
I still don't know how to change the shared library path in Linux. Probably have to use hexadecimal editor such as HT From Stackoverflow Answer
这篇关于gpuDevice()工具包版本总是5.5的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
- 转到