Skip to content

Comments

Fallback to different cuDNN algorithm when under memory pressure#2211

Merged
shelhamer merged 1 commit intoBVLC:masterfrom
nsubtil:fix-cudnn-algo
Mar 26, 2015
Merged

Fallback to different cuDNN algorithm when under memory pressure#2211
shelhamer merged 1 commit intoBVLC:masterfrom
nsubtil:fix-cudnn-algo

Conversation

@nsubtil
Copy link
Contributor

@nsubtil nsubtil commented Mar 26, 2015

CUDNN_CONVOLUTION_FWD_PREFER_FASTEST requires a lot of GPU memory, which may
not always be available. Add a fallback path that uses
CUDNN_CONVOLUTION_FWD_ALGO_IMPLICIT_GEMM when the allocation fails.

CUDNN_CONVOLUTION_FWD_PREFER_FASTEST requires a lot of GPU memory, which may
not always be available. Add a fallback path that uses
CUDNN_CONVOLUTION_FWD_ALGO_IMPLICIT_GEMM when the allocation fails.
@shelhamer
Copy link
Member

I can confirm this works for models like CaffeNet where #2038 runs out of memory.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this always rule out the cuDNN GEMM convolution? At least in the Caffe GEMM convolution the workspace is the kernel dimensions (kernel_h * kernel_w * channels) * output dimensions (height_out_* width_out_) as in https://github.com/BVLC/caffe/blob/master/src/caffe/layers/base_conv_layer.cpp#L147, although in the cuDNN implementation I suppose the workspace could be just the input data so the +1 allows it here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, my understanding is that the workspace size depends only on the input data size.

The intent is that GEMM convolution will still be chosen if possible. However, in practice, we expect that there won't be enough memory available in many use cases.

@shelhamer
Copy link
Member

Thanks for the fix @nsubtil! Please address my inline comments for merge.

@nsubtil
Copy link
Contributor Author

nsubtil commented Mar 26, 2015

It sounds like no further code changes are actually required here. If you're satisfied with my replies, I think this should be ready to merge.

Thanks!

shelhamer added a commit that referenced this pull request Mar 26, 2015
Fallback to different cuDNN algorithm when under memory pressure; fix #2197
@shelhamer shelhamer merged commit 5c009d8 into BVLC:master Mar 26, 2015
@nsubtil nsubtil deleted the fix-cudnn-algo branch March 26, 2015 23:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants