An unexpected error occurred during CUDA execution. The CUDA error was: CUDA_ERROR_ILLEGAL_ADDRESS
Show older comments
I try to execute the following test to use GPU computing in Matlab2016a but always get an error about illegal memory access, which I don't know how to resolve.
Driver
N = 6;
M = magic(N);
G = gpuArray(M);
Error using gpuArray
An unexpected error occurred during CUDA execution. The CUDA error was:
CUDA_ERROR_ILLEGAL_ADDRESS
I checked my GPU device and get the following report which seems fine
gpuDevice(1)
ans =
CUDADevice with properties:
Name: 'GeForce GTX 1080'
Index: 1
ComputeCapability: '6.1'
SupportsDouble: 1
DriverVersion: 8
ToolkitVersion: 7.5000
MaxThreadsPerBlock: 1024
MaxShmemPerBlock: 49152
MaxThreadBlockSize: [1024 1024 64]
MaxGridSize: [2.1475e+09 65535 65535]
SIMDWidth: 32
TotalMemory: 8.5899e+09
AvailableMemory: 8.0519e+09
MultiprocessorCount: 20
ClockRateKHz: 1809500
ComputeMode: 'Default'
GPUOverlapsTransfers: 1
KernelExecutionTimeout: 1
CanMapHostMemory: 1
DeviceSupported: 1
DeviceSelected: 1
Also this seems to work fine:
mexcuda mexGPUExample.cu
Building with 'NVIDIA CUDA Compiler'.
MEX completed successfully.
I try to use the GPU computing for the first time on a Windows7, Visual Studio Communit 2013, CUDA 7.5. I also set the system variable for the CUDA_Cache_MAXSIZE but I am unsure what is wrong with the access to the device. Does anyone have experience with such an issue?
Answers (2)
Joss Knight
on 7 Feb 2017
Edited: Joss Knight
on 7 Feb 2017
1 vote
CUDA 7.5 has significant issues with Pascal cards.
The first port of call is to make sure you have the most up-to-date drivers for your particular card, by downloading them from the NVIDIA website. If this doesn't help, tech support may be able to help you work out how to work around the issue for your particular use case, until MATLAB R2017a comes out (which uses CUDA 8.0 and has full support for Pascal).
Most things work, but there are some significant issues, particularly on Windows 7 (CONV2, FILTER, INTERP3).
SFSpikes
on 7 Feb 2017
0 votes
8 Comments
Joss Knight
on 7 Feb 2017
I've got to say, your reproduction is extremely unusual. I myself can successfully run this code on Windows 7 on a GTX 1080 in MATLAB R2016a. I would say that probably there's something wrong with your setup, because you've got a failure to just copy data to the card, whereas the problems with Pascal cards are caused by errors in the code generation for MATLAB kernels.
You might want to confirm that you can compile and run some of the CUDA samples that come with the toolkit.
Joss Knight
on 8 Feb 2017
Edited: Joss Knight
on 8 Feb 2017
Okay. Well, this is because FILTER isn't working properly on Pascal cards. If you have access to the R2017a prerelease I suggest to do that. Otherwise, if your filter is simple then you can probably reimplement it using FFT/IFFT.
Once you have run a kernel that errors with an illegal address access like this, you need to reset the card or every use of the GPU will return the same error.
SFSpikes
on 8 Feb 2017
Nadeem Ansari
on 25 Jul 2021
Is your problem is resolved?
I have same issue.
Please suggest
Walter Roberson
on 25 Jul 2021
Which MATLAB release are you using? What kind of GPU do you have? What CUDA driver version do you have installed?
Nadeem Ansari
on 2 Aug 2021
MATLAB 2021

Walter Roberson
on 2 Aug 2021
It looks to me as if that driver version is correct for that device, and that that class of device should be supported by R2021a.
I think you are going to need to open a support case with Mathworks.
Categories
Find more on Get Started with GPU Coder in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!