-3

I don't have CUDA-enabled Nvidia GPU, and I want to force MATLAB to run the code on CPU instead of GPU (yes, I know, it will be very very slow). How can I do it?

As an example, let’s try to run this code on my PC without CUDA. Here is the error given by MATLAB:

There is a problem with the CUDA driver or with this GPU device. Be sure that you have a supported GPU and that the latest driver is installed.

Error in nnet.internal.cnn.SeriesNetwork/activations (line 48) 
output = gpuArray(data); 

Error in SeriesNetwork/activations (line 269) 
YChannelFormat = predictNetwork.activations(X, layerID); 

Error in DeepLearningImageClassificationExample (line 262) 
trainingFeatures = activations(convnet, trainingSet, featureLayer, ... 

Caused by: 
The CUDA driver could not be loaded. The library name used was 'nvcuda.dll'. The error was: 
The specified module could not be found.
sco1
  • 12,154
  • 5
  • 26
  • 48
Sadegh
  • 865
  • 1
  • 23
  • 47
  • 1
    AFAIK, after you do the conversion `output = gpuArray(data)`, operations that manipulate the `output` will be done on the GPU. So I'd start by removing the conversion, i.e. replace it with `output=data;` and see how the program behaves after that. – mkfin May 19 '16 at 06:22
  • This is a duplicate of http://stackoverflow.com/q/3087361/103167 and http://stackoverflow.com/q/21946701/103167 – Ben Voigt Jun 13 '16 at 18:45
  • Make the first line after the function definition "keyboard" this will pause the function execution and give you access to your keyboard, now run each line one after the other such that you can see what works and what fails. However I do also suspect that mkfin comment is what you are looking for. Alternatively use a CUDA emulator as suggested by Ben Voigt. – Nicky Mattsson Jun 14 '16 at 05:38
  • tnx @BenVoigt for links. now the question is which method is applicable in Matlab? – Sadegh Jun 14 '16 at 21:24
  • You can't. If you understand the very basic prociples of programming you willbe aware that code to work on A does not work on B. Code designed to run on GPUs can not run on CPUs as it is, unless rewritten. – Ander Biguri Jun 15 '16 at 13:00
  • @AnderBiguri If you understand basic of programming, emulators run code written for A on B. – Sadegh Jun 15 '16 at 14:01
  • @Woeitg yes, because you can emulate everything. – Ander Biguri Jun 15 '16 at 14:56
  • 1
    @PeterMortensen please do not put console outputs into quotation tags, it is not monospaced and ruins the formatting. – sco1 Jun 15 '16 at 19:09
  • Note that if you can't use deep learning code with your current version of matlab, you could also use an older version for this project. – Dennis Jaheruddin Jun 20 '16 at 15:08

2 Answers2

1

With R2016a, the ConvNet "functionality requires the Parallel Computing Toolbox™ and a CUDA®-enabled NVIDIA® GPU with compute capability 3.0 or higher."

See: http://uk.mathworks.com/help/nnet/convolutional-neural-networks.html

ManWithSleeve
  • 2,647
  • 2
  • 15
  • 5
-1

The code example that you link to requires a GPU. As such the solution is very simple:

You need to use different code.

In your question it is not mentioned specifically what you are trying to achieve, so it is hard to say whether you would need to create something your self or will be able to pick up an exisiting solution, but this CPU vs GPU deep learning benchmark may be an inspiration.

Dennis Jaheruddin
  • 21,208
  • 8
  • 66
  • 122