필터 지우기
필터 지우기

Matlab gpuArray doesn't work with sparse arrays

조회 수: 9 (최근 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 CenterFile Exchange에서 Introduction to Installation and Licensing에 대해 자세히 알아보기

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by