Fixed running Caffe build with CUDA and CUDNN on hardware without GPU #6775
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.