简体   繁体   中英

How to know if CAFFE code is running using GPU or CUDA code?

I known that almost layer in CAFFE can run in CPU/GPU. In case of GPU, it has some mode, called engine. If engine=CAFFE , it will run with GPU and engine=CUDNN , it will run based on CUDA code. The default is DEFAULT mode

In my Makefile.config, I turn on CUDNN mode when build caffe

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

In my prototxt, I have a layer, for example, Deconvolution layer

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"
    }    
  }
}

Note that, I did not set any value for engine flag. When I run, which mode will be use, GPU or CUDNN? The training script is

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

If you look into the caffe.proto it says "The default for the engine is set by the ENGINE switch at compile-time." . If you look into the layer_factory.cpp if USE_CUDNN is set then the default engine is set to cuDNN . So in your case it is CUDNN.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM