MATLAB Answers

Out of memory on device. To view more detail about available memory on the GPU, use 'gpuDevice()'

9 views (last 30 days)
Alberto Paniate
Alberto Paniate on 24 Jul 2021
Edited: Matt J on 24 Jul 2021
Hi, I am using a new pc and I have found this problem for the first time. The error is the following:
Error using gpuArray/subsref
Out of memory on device. To view more detail about available memory on the GPU, use 'gpuDevice()'. If the problem persists, reset the GPU by calling 'gpuDevice(1)'.
Error in matlab.internal.builtinhelper.circshift (line 87)
b = a(idx{:});
Error in ifftshift (line 27)
x = circshift(x,ceil(size(x)/2));
Error in propagate2 (line 130)
Eout_pad=ifft2(ifftshift(E0fft.*H.*mask));
Error in Prova24luglioOutofMemory (line 17)
D=propagate2(A, lambda, dz1, ps);
where A is a matrix, lambda, dz1 and ps numbers in order to propagate the matrix in free space.
If I execute gpuDevice()
CUDADevice with properties:
Name: 'GeForce MX330'
Index: 1
ComputeCapability: '6.1'
SupportsDouble: 1
DriverVersion: 11
ToolkitVersion: 10.1000
MaxThreadsPerBlock: 1024
MaxShmemPerBlock: 49152
MaxThreadBlockSize: [1024 1024 64]
MaxGridSize: [2.1475e+09 65535 65535]
SIMDWidth: 32
TotalMemory: 2.1475e+09
AvailableMemory: 1.6409e+09
MultiprocessorCount: 3
ClockRateKHz: 1594000
ComputeMode: 'Default'
GPUOverlapsTransfers: 1
KernelExecutionTimeout: 1
CanMapHostMemory: 1
DeviceSupported: 1
DeviceSelected: 1
How can I overcome this problem?
I have found that if I have a size of the matrix A less than 4000 I have no problem but when I overcome that limit, I found this error message
  3 Comments
Matt J
Matt J on 24 Jul 2021
Yes. The output of gpuDevice says that your GPU card (the GeForce MX330) has only about 2 GB RAM total. I don't know what other variables your propagate2() function is creating on the GPU but it is clearly exceeding the space you have there.

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!