CUDA seems not to be supported
이전 댓글 표시
My GPU is NVIDA GTX 1660, and I succeeded in updating my CUDA toolkit to 12.6, as confrimed by nvcc --version
C:\Users\Administrator>nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2024 NVIDIA Corporation
Built on Thu_Sep_12_02:55:00_Pacific_Daylight_Time_2024
Cuda compilation tools, release 12.6, V12.6.77
Build cuda_12.6.r12.6/compiler.34841621_0
Yet in MATLAB 2024a
>> gpuDevice
ans =
CUDADevice with properties:
Name: 'NVIDIA GeForce GTX 1660 Ti'
Index: 1
ComputeCapability: '7.5'
SupportsDouble: 1
GraphicsDriverVersion: '560.94'
DriverModel: 'WDDM'
ToolkitVersion: 12.199999999999999
MaxThreadsPerBlock: 1024
MaxShmemPerBlock: 49152 (49.15 KB)
MaxThreadBlockSize: [1024 1024 64]
MaxGridSize: [2.147483647000000e+09 65535 65535]
SIMDWidth: 32
TotalMemory: 6442123264 (6.44 GB)
AvailableMemory: 5378138112 (5.38 GB)
CachePolicy: 'balanced'
MultiprocessorCount: 24
ClockRateKHz: 1770000
ComputeMode: 'Default'
GPUOverlapsTransfers: 1
KernelExecutionTimeout: 1
CanMapHostMemory: 1
DeviceSupported: 1
DeviceAvailable: 1
DeviceSelected: 1
ToolkitVersion: 12.199999999999999 remains so. Is there anything I can do for MATLAB to recognise and use the latest toolkit? Cheers.
답변 (2개)
Joss Knight
2024년 11월 4일
1 개 추천
MATLAB does not use the toolkit that you download, it installs its own version. You cannot change it by downloading the toolkit. What is it you are trying to do?
Walter Roberson
2024년 11월 2일
0 개 추천
There is a difference between the toolkit version and the nvcc version. The toolkit version is essentially the driver version that is used all the time; the nvcc version is used only when you specifically ask to compile (for example you use mexcuda )
댓글 수: 6
Joss Knight
2024년 11월 4일
Note: mexcuda uses the toolkit that MATLAB ships and does not use the version you download unless you specify MW_NVCC_PATH.
The toolkit does also come with a GPU driver but its main purpose is to provide libraries of algorithms and the compilation toolchain, all of which are shipped with your copy of MATLAB.
To install the latest driver you should find it on the NVIDIA driver downloads site, as explained on our GPU Computing Requirements page. You should not install the CUDA toolkit.
Theron FARRELL
2024년 11월 5일
Joss Knight
2024년 11월 11일
It sounds like you are mixing a GPU Coder code generation strategy with a PCT mexcuda build strategy? That no doubt makes things a bit muddled. Do you actually need to do it this way? Typically, generating code is not necessary within a MATLAB workflow; it is targeted at deployment to an embedded device. Any verification within MATLAB via MEX would typically be done through Coder apps and commands rather than through mexcuda (see for instance https://uk.mathworks.com/help/gpucoder/gs/gpucoder-verification.html)
If you need to use GPU Coder, perhaps because you are enhancing a C++ AI model with your own extensions in C++, then a number of options are available to you. But first - can you not recompile your existing code with CUDA 12.2?
To change your toolkit path to an unsupported version of the toolkit, you need to do some advanced things, so let's try something else first.
Theron FARRELL
2024년 11월 24일
편집: Theron FARRELL
2024년 11월 24일
Joss Knight
2024년 12월 1일
편집: Joss Knight
2024년 12월 1일
This is not my area of expertise, so I'm not sure what those files are for. I doubt there's any harm in including them (I doubt they take up much space, and they will be stripped if you are using static linking) or excluding them (you'll get a build error if you need them).
Your libraries built using CUDA 12.2 should work perfectly fine with the rest of your project. The question is whether the other-way-round will work, namely, trying to build an executable mex function using CUDA 12.2 which links against libraries built using CUDA 12.6. I think that will work, as in nvcc won't compain, although there is a small risk of runtime errors because minor versions promise to be backwards compatibly not forwards compatible (they are supposed to be binary compatible across all the 12.x libraries, but there's nothing to stop someone using a new 12.6 API in a library that isn't available at runtime because the version of, say, cublas loaded at runtime is the one MATLAB loads, the 12.2 one, which maybe doesn't have that API). Still, if you're having issues I'd just rebuild the rest of your project using CUDA 12.2.
If you want to change the behaviour of mex you can use mexcuda -v to find your options file, copy it, edit it to remove checks for CUDA 12.2, and then use the -f option to target the modified options file. But this is advanced. And regardless, you do incur some risk forcing libraries built against the CUDA 12.6 runtime to run alongside libraries built with the CUDA 12.2 runtime (i.e. MATLAB's libraries), so if you can just rebuild against 12.2 across the board your life is going to be simpler.
Theron FARRELL
2024년 12월 30일
카테고리
도움말 센터 및 File Exchange에서 Startup and Shutdown에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

