BVLC / caffe

Caffe: a fast open framework for deep learning.
http://caffe.berkeleyvision.org/
Other
34.09k stars 18.7k forks source link

Fixed running Caffe build with CUDA and CUDNN on hardware without GPU #6775

Open artyom-beilis opened 5 years ago

artyom-beilis commented 5 years ago

There is a selection to run caffe with CPU or GPU mode in the API.

It makes it very useful to deploy the library on different hardware allowing user to enable GPU support if available by simple setting CPU or GPU caffe mode.

However in the current version if the library is compiled with CUDNN it would fail to run if Caffe::mode(CPU) is selected. This patch fixes this issue allowing to select GPU or CPU in runtime without requiring the library to be compiled in CPU only mode.

The root cause of the issue is that CUDNN layers allocate different GPU resources on start even if they run in CPU mode. This fix disables CUDNN based layer and switches them to native Caffe layers when working in CPU mode.

artyom-beilis commented 5 years ago

Updated pool request for test fix

artyom-beilis commented 5 years ago

Hello, are there any chances for this branch to be merged?