Matlab gpuArray doesn't work with sparse arrays

7 ビュー (過去 30 日間)
雨文
雨文 2023 年 2 月 19 日
回答済み: Animesh 2023 年 5 月 12 日
The Matlab gpuArray works perfectly for non-sparse matrices, e.g., x=gpuArray(eye(1)).
But when the input changed to sparse arrays, e.g., x=gpuArray(speye(1)), I got the following error message
Error using gpuArray
An unexpected error occurred on the device. The error code was: UNKNOWN_ERROR.
How can I fix it?
My gpu is RTX 4090 with nvidia game ready driver 528.29, cuda version 12.0,
My gpuDevice outputs the following results
CUDADevice with properties:
Name: 'NVIDIA GeForce RTX 4090'
Index: 1
ComputeCapability: '8.9'
SupportsDouble: 1
DriverVersion: 12
ToolkitVersion: 11.2000
MaxThreadsPerBlock: 1024
MaxShmemPerBlock: 49152 (49.15 KB)
MaxThreadBlockSize: [1024 1024 64]
MaxGridSize: [2.1475e+09 65535 65535]
SIMDWidth: 32
TotalMemory: 25756696576 (25.76 GB)
AvailableMemory: 23916261376 (23.92 GB)
MultiprocessorCount: 128
ClockRateKHz: 2535000
ComputeMode: 'Default'
GPUOverlapsTransfers: 1
KernelExecutionTimeout: 1
CanMapHostMemory: 1
DeviceSupported: 1
DeviceAvailable: 1
DeviceSelected: 1
  7 件のコメント
Bruno Luong
Bruno Luong 2023 年 2 月 19 日
@Walter Roberson "someone from Mathworks say that Update 4 had been restored"
Not seeing anything showed up on my side.
雨文
雨文 2023 年 2 月 19 日
Well, I manually downloaded R2022b Update 4 from Download MATLAB, Simulink, Stateflow and Other MathWorks Products and reinstalled it.
Unfortunately, it doesn't work neither. As Joss said, this might be a problem specific to gpu with Ada Lovelace architechture.

サインインしてコメントする。

回答 (1 件)

Animesh
Animesh 2023 年 5 月 12 日
Hi,
I understand that when you try to create sparse array/matrix on a GPU, it pops an error whereas when try for normal arrays/matrices on GPU it works fine.
This is a known issue with Ada Lovelace graphic cards and CUDA 11.2.
As a workaround the following steps can be helpful:
On Windows machine:
  1. Install the CUDA Toolkit version 11.3.
  2. Open MATLAB.
  3. Before executing any other command, execute the below two commands and ignore the warning message:
>> loadlibrary('E:\3rdparty\R2023a\9378850\win64\CUDA\bin\cusparse64_11.dll', 'E:\3rdparty\R2023a\9378850\win64\CUDA\include\cuComplex.h', 'addheader', 'E:\3rdparty\R2023a\9378850\win64\CUDA\include\cusparse.h', 'addheader','E:\3rdparty\R2023a\9378850\win64\CUDA\include\cusparse.h');
>> loadlibrary('E:\3rdparty\R2023a\9378850\win64\CUDA\bin\cusolver64_11.dll', 'E:\3rdparty\R2023a\9378850\win64\CUDA\include\cusolver_common.h', 'addheader', 'E:\3rdparty\R2023a\9378850\win64\CUDA\include\cusolverDn.h', 'addheader','E:\3rdparty\R2023a\9378850\win64\CUDA\include\cusolverMg.h', 'addheader', 'E:\3rdparty\R2023a\9378850\win64\CUDA\include\cusolverRf.h', 'addheader','E:\3rdparty\R2023a\9378850\win64\CUDA\include\cusolverSp.h', 'addheader', 'E:\3rdparty\R2023a\9378850\win64\CUDA\include\cusolverSp_LOWLEVEL_PREVIEW.h');
4. Execute your code.
On Linux machine:
  1. Install the CUDA Toolkit version 11.3.
  2. Before opening MATLAB, open a terminal and set the environment variable ‘LD_PRELOAD’ to point to paths of cuSPARSE and cuSOLVER libraries of the CUDA version 11.3.
setenv LD_PRELOAD /usr/local/cuda-11.3/lib64/libcusolver.so.11.1.1.58:/usr/local/cuda-11.3/lib64/libcusolver.so:/usr/local/cuda-11.3/lib64/libcusolver.so.11:/usr/local/cuda-11.3/lib64/libcusparse.so:/usr/local/cuda-11.3/lib64/libcusparse.so.11:/usr/local/cuda-11.3/lib64/libcusparse.so.11.5.0.58
3. Open MATLAB and execute your code.
I hope this helps.

カテゴリ

Help Center および File ExchangeGPU Computing についてさらに検索

製品


リリース

R2022b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by