Error using gpuArray MATLAB tried to use GPU device 1, but the device is busy or unavailable.

I am fairly new to the GPU stuff. I executed the following code
N = 6;
M = magic(N);
G = gpuArray(M);
and the error:
Error using gpuArray MATLAB tried to use GPU device 1, but the device is busy or unavailable.
pops up.
When I use gpuDevice to know about CUDA properties this is what I see.
ans =
CUDADevice with properties:
Name: 'GeForce 940M'
Index: 1
ComputeCapability: '5.0'
SupportsDouble: 1
DriverVersion: 8
ToolkitVersion: 5
MaxThreadsPerBlock: 1024
MaxShmemPerBlock: 49152
MaxThreadBlockSize: [1024 1024 64]
MaxGridSize: [2.1475e+09 65535 65535]
SIMDWidth: 32
TotalMemory: 2.1475e+09
FreeMemory: NaN
MultiprocessorCount: 3
ClockRateKHz: 1176000
ComputeMode: 'Default'
GPUOverlapsTransfers: 1
KernelExecutionTimeout: 1
CanMapHostMemory: 1
DeviceSupported: 1
DeviceSelected: 0
I wonder why is this happening. I saw few answers saying the DeviceSelected must be 1, but its zero in my case. Am using matlab R2013a. Can any one let me know how to enable it and make it 1 and also why this error is popping up. Any help is appreciated. Thanks in Advance.

2 Comments

I have the same issue as OP (although with a different GPU). When I run nvidia-smi, I get the following:
%
C:\Program Files\NVIDIA Corporation\NVSMI>nvidia-smi
Fri May 13 11:09:12 2016
+------------------------------------------------------+
| NVIDIA-SMI 364.72 Driver Version: 364.72 |
|-------------------------------+----------------------+----------------------+
| GPU Name TCC/WDDM | Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
|===============================+======================+======================|
| 0 GeForce GT 750M WDDM | 0000:02:00.0 N/A | N/A |
| N/A 58C P8 N/A / N/A | 56MiB / 2048MiB | N/A Default |
+-------------------------------+----------------------+----------------------+
+-----------------------------------------------------------------------------+
| Processes: GPU Memory |
| GPU PID Type Process name Usage |
|=============================================================================|
| 0 Not Supported |
+-----------------------------------------------------------------------------+

Sign in to comment.

Answers (1)

I've solved this problem by updating my GPU driver. Maybe you can try the same way.

Asked:

on 15 Mar 2016

Edited:

on 30 Nov 2016

Community Treasure Hunt

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

Start Hunting!