【问题标题】:How to know if CAFFE code is running using GPU or CUDA code?如何知道 CAFFE 代码是使用 GPU 还是 CUDA 代码运行?
【发布时间】:2017-09-04 11:26:46
【问题描述】:

我知道 CAFFE 中的几乎层都可以在 CPU/GPU 中运行。在 GPU 的情况下,它有一些模式,称为引擎。如果engine=CAFFE,它将使用 GPU 运行,engine=CUDNN,它将基于 CUDA 代码运行。默认为默认模式

在我的 Makefile.config 中,我在构建 caffe 时打开了 CUDNN 模式

# cuDNN acceleration switch (uncomment to build with cuDNN).
USE_CUDNN := 1

在我的prototxt中,我有一个层,例如,反卷积层

layer {
  name: "DeconvolutionLayer"
  type: "Deconvolution"
  bottom: "conv1"
  top: "DeconvolutionLayer"
  param {
    lr_mult: 1
    decay_mult: 1
  }
  convolution_param {
    num_output: 128
    bias_term: false
    pad: 0
    kernel_size: 2
    stride: 2
    weight_filler {
      type: "msra"
    }    
  }
}

请注意,我没有为 engine 标志设置任何值。当我运行时,将使用哪种模式,GPU 还是 CUDNN?训练脚本是

caffe/build/tools/caffe train --solver=solver.prototxt -gpu 0

【问题讨论】:

    标签: machine-learning deep-learning caffe


    【解决方案1】:

    如果您查看caffe.proto,它会显示"The default for the engine is set by the ENGINE switch at compile-time."。如果您查看layer_factory.cpp,如果设置了USE_CUDNN,则默认引擎设置为cuDNN。所以在你的情况下,它是 CUDNN。

    【讨论】:

      猜你喜欢
      • 2020-07-18
      • 2012-02-27
      • 1970-01-01
      • 2017-09-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多