An unexpected error occurred during CUDA execution. The CUDA error was: CUDA_ERROR​_ILLEGAL_A​DDRESS

37 views (last 30 days)
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
Joss Knight on 7 Feb 2017
Edited: Joss Knight on 7 Feb 2017
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
SFSpikes on 7 Feb 2017
Hi,
Thanks for your feedback. I have the most up-to-date drivers for my NVDIDIA GEForce GTX1080 card and I set the MAX_SIZE_CACHE as described. Yet I still get the same error message and will need to use FILTER. Any other solutions?
  8 Comments
Walter Roberson
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.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!