How do I force MATLAB to run deep learning code on the CPU instead of the GPU?

独自空忆成欢 提交于 2020-01-14 07:09:12

问题


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.

回答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




回答2:


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.



来源:https://stackoverflow.com/questions/37310280/how-do-i-force-matlab-to-run-deep-learning-code-on-the-cpu-instead-of-the-gpu

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!