【问题标题】:How do I force MATLAB to run deep learning code on the CPU instead of the GPU?如何强制 MATLAB 在 CPU 而不是 GPU 上运行深度学习代码?
【发布时间】:2016-05-18 21:19:10
【问题描述】:

我没有启用CUDA 的 Nvidia GPU,我想强制 MATLAB 在 CPU 而不是 GPU 上运行代码(是的,我知道,它会非常非常慢)。我该怎么做?

例如,让我们尝试在没有 CUDA 的 PC 上运行 this code。这是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.

【问题讨论】:

  • AFAIK,在您完成转换output = gpuArray(data) 之后,操纵output 的操作将在GPU 上完成。所以我首先要删除转换,即用output=data; 替换它,然后看看程序的行为。
  • 在函数定义 "keyboard" 之后创建第一行,这将暂停函数执行并让您可以访问键盘,现在逐行运行每一行,这样您就可以看到哪些有效,哪些有效失败。但是,我也怀疑 mkfin 评论是您正在寻找的。或者按照 Ben Voigt 的建议使用 CUDA 模拟器。
  • tnx @BenVoigt 获取链接。现在的问题是哪种方法适用于 Matlab?
  • @PeterMortensen 请不要将控制台输出放入引号标签中,它不是等宽的并且会破坏格式。

标签: matlab compilation deep-learning


【解决方案1】:

对于 R2016a,ConvNet “功能需要 Parallel Computing Toolbox™ 和支持 CUDA® 且具有 3.0 或更高计算能力的 NVIDIA® GPU。”

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

【讨论】:

  • 这是我所知道的。问题是如何克服这个限制
【解决方案2】:

您链接到的代码示例需要 GPU。因此解决方案非常简单:

你需要使用不同的代码。

在你的问题中没有具体提到你想要达到的目标,所以很难说你是否需要自己创造一些东西或者能够选择现有的解决方案,但是这个CPU vs GPU deep learning benchmark 可能成为灵感。

【讨论】:

  • 值得了解的一点:如果需要,matlab 许可证应该允许您在现有的 Matlab 旁边运行旧版本的 Matlab。
猜你喜欢
  • 1970-01-01
  • 2017-04-06
  • 2020-07-26
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-11-05
  • 2022-01-17
相关资源
最近更新 更多