Skip to content

Commit

Permalink
cuDNN 8だとビルドに失敗する部分をコメントアウト(学習が出来なくなった)
Browse files Browse the repository at this point in the history
  • Loading branch information
lltcggie committed Sep 5, 2020
1 parent ed6cff4 commit 9d5aa36
Show file tree
Hide file tree
Showing 2 changed files with 83 additions and 83 deletions.
42 changes: 21 additions & 21 deletions src/caffe/layers/cudnn_conv_layer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,27 +202,27 @@ void CuDNNConvolutionLayer<Dtype>::Reshape(

if (this->phase_ == TRAIN)
{
// choose backward algorithm for filter
CUDNN_CHECK(cudnnGetConvolutionBackwardFilterAlgorithm(handle_[0],
bottom_descs_[i], top_descs_[i], conv_descs_[i], filter_desc_,
CUDNN_CONVOLUTION_BWD_FILTER_SPECIFY_WORKSPACE_LIMIT,
workspace_limit_bytes, &bwd_filter_algo_[i]));

// get workspace for backwards filter algorithm
CUDNN_CHECK(cudnnGetConvolutionBackwardFilterWorkspaceSize(handle_[0],
bottom_descs_[i], top_descs_[i], conv_descs_[i], filter_desc_,
bwd_filter_algo_[i], &workspace_bwd_filter_sizes_[i]));

// choose backward algo for data
CUDNN_CHECK(cudnnGetConvolutionBackwardDataAlgorithm(handle_[0],
filter_desc_, top_descs_[i], conv_descs_[i], bottom_descs_[i],
CUDNN_CONVOLUTION_BWD_DATA_SPECIFY_WORKSPACE_LIMIT,
workspace_limit_bytes, &bwd_data_algo_[i]));

// get workspace size
CUDNN_CHECK(cudnnGetConvolutionBackwardDataWorkspaceSize(handle_[0],
filter_desc_, top_descs_[i], conv_descs_[i], bottom_descs_[i],
bwd_data_algo_[i], &workspace_bwd_data_sizes_[i]));
//// choose backward algorithm for filter
//CUDNN_CHECK(cudnnGetConvolutionBackwardFilterAlgorithm(handle_[0],
// bottom_descs_[i], top_descs_[i], conv_descs_[i], filter_desc_,
// CUDNN_CONVOLUTION_BWD_FILTER_SPECIFY_WORKSPACE_LIMIT,
// workspace_limit_bytes, &bwd_filter_algo_[i]));

//// get workspace for backwards filter algorithm
//CUDNN_CHECK(cudnnGetConvolutionBackwardFilterWorkspaceSize(handle_[0],
// bottom_descs_[i], top_descs_[i], conv_descs_[i], filter_desc_,
// bwd_filter_algo_[i], &workspace_bwd_filter_sizes_[i]));

//// choose backward algo for data
//CUDNN_CHECK(cudnnGetConvolutionBackwardDataAlgorithm(handle_[0],
// filter_desc_, top_descs_[i], conv_descs_[i], bottom_descs_[i],
// CUDNN_CONVOLUTION_BWD_DATA_SPECIFY_WORKSPACE_LIMIT,
// workspace_limit_bytes, &bwd_data_algo_[i]));

//// get workspace size
//CUDNN_CHECK(cudnnGetConvolutionBackwardDataWorkspaceSize(handle_[0],
// filter_desc_, top_descs_[i], conv_descs_[i], bottom_descs_[i],
// bwd_data_algo_[i], &workspace_bwd_data_sizes_[i]));
}
}

Expand Down
124 changes: 62 additions & 62 deletions src/caffe/layers/cudnn_deconv_layer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,68 +143,68 @@ void CuDNNDeconvolutionLayer<Dtype>::Reshape(
stride_w);

if (this->phase_ == TRAIN) {
// choose forward and backward algorithms + workspace(s)
CUDNN_CHECK(cudnnGetConvolutionForwardAlgorithm(
handle_[0],
top_descs_[i],
filter_desc_,
conv_descs_[i],
bottom_descs_[i],
CUDNN_CONVOLUTION_FWD_SPECIFY_WORKSPACE_LIMIT,
workspace_limit_bytes,
&fwd_algo_[i]));

// We have found that CUDNN_CONVOLUTION_FWD_ALGO_IMPLICIT_PRECOMP_GEMM is
// buggy. Thus, if this algo was chosen, choose winograd instead. If
// winograd is not supported or workspace is larger than threshold, choose
// implicit_gemm instead.
if (fwd_algo_[i] == CUDNN_CONVOLUTION_FWD_ALGO_IMPLICIT_PRECOMP_GEMM) {
size_t winograd_workspace_size;
cudnnStatus_t status = cudnnGetConvolutionForwardWorkspaceSize(
handle_[0],
top_descs_[i],
filter_desc_,
conv_descs_[i],
bottom_descs_[i],
CUDNN_CONVOLUTION_FWD_ALGO_WINOGRAD,
&winograd_workspace_size);
if (status != CUDNN_STATUS_SUCCESS ||
winograd_workspace_size >= workspace_limit_bytes) {
fwd_algo_[i] = CUDNN_CONVOLUTION_FWD_ALGO_IMPLICIT_GEMM;
} else {
fwd_algo_[i] = CUDNN_CONVOLUTION_FWD_ALGO_WINOGRAD;
}
}

CUDNN_CHECK(cudnnGetConvolutionForwardWorkspaceSize(
handle_[0],
top_descs_[i],
filter_desc_,
conv_descs_[i],
bottom_descs_[i],
fwd_algo_[i],
&(workspace_fwd_sizes_[i])));

// choose backward algorithm for filter
CUDNN_CHECK(cudnnGetConvolutionBackwardFilterAlgorithm(
handle_[0],
top_descs_[i],
bottom_descs_[i],
conv_descs_[i],
filter_desc_,
CUDNN_CONVOLUTION_BWD_FILTER_SPECIFY_WORKSPACE_LIMIT,
workspace_limit_bytes,
&bwd_filter_algo_[i]));

// get workspace for backwards filter algorithm
CUDNN_CHECK(cudnnGetConvolutionBackwardFilterWorkspaceSize(
handle_[0],
top_descs_[i],
bottom_descs_[i],
conv_descs_[i],
filter_desc_,
bwd_filter_algo_[i],
&workspace_bwd_filter_sizes_[i]));
//// choose forward and backward algorithms + workspace(s)
//CUDNN_CHECK(cudnnGetConvolutionForwardAlgorithm(
// handle_[0],
// top_descs_[i],
// filter_desc_,
// conv_descs_[i],
// bottom_descs_[i],
// CUDNN_CONVOLUTION_FWD_SPECIFY_WORKSPACE_LIMIT,
// workspace_limit_bytes,
// &fwd_algo_[i]));

//// We have found that CUDNN_CONVOLUTION_FWD_ALGO_IMPLICIT_PRECOMP_GEMM is
//// buggy. Thus, if this algo was chosen, choose winograd instead. If
//// winograd is not supported or workspace is larger than threshold, choose
//// implicit_gemm instead.
//if (fwd_algo_[i] == CUDNN_CONVOLUTION_FWD_ALGO_IMPLICIT_PRECOMP_GEMM) {
// size_t winograd_workspace_size;
// cudnnStatus_t status = cudnnGetConvolutionForwardWorkspaceSize(
// handle_[0],
// top_descs_[i],
// filter_desc_,
// conv_descs_[i],
// bottom_descs_[i],
// CUDNN_CONVOLUTION_FWD_ALGO_WINOGRAD,
// &winograd_workspace_size);
// if (status != CUDNN_STATUS_SUCCESS ||
// winograd_workspace_size >= workspace_limit_bytes) {
// fwd_algo_[i] = CUDNN_CONVOLUTION_FWD_ALGO_IMPLICIT_GEMM;
// } else {
// fwd_algo_[i] = CUDNN_CONVOLUTION_FWD_ALGO_WINOGRAD;
// }
//}

//CUDNN_CHECK(cudnnGetConvolutionForwardWorkspaceSize(
// handle_[0],
// top_descs_[i],
// filter_desc_,
// conv_descs_[i],
// bottom_descs_[i],
// fwd_algo_[i],
// &(workspace_fwd_sizes_[i])));

//// choose backward algorithm for filter
//CUDNN_CHECK(cudnnGetConvolutionBackwardFilterAlgorithm(
// handle_[0],
// top_descs_[i],
// bottom_descs_[i],
// conv_descs_[i],
// filter_desc_,
// CUDNN_CONVOLUTION_BWD_FILTER_SPECIFY_WORKSPACE_LIMIT,
// workspace_limit_bytes,
// &bwd_filter_algo_[i]));

//// get workspace for backwards filter algorithm
//CUDNN_CHECK(cudnnGetConvolutionBackwardFilterWorkspaceSize(
// handle_[0],
// top_descs_[i],
// bottom_descs_[i],
// conv_descs_[i],
// filter_desc_,
// bwd_filter_algo_[i],
// &workspace_bwd_filter_sizes_[i]));
}
else {
workspace_fwd_sizes_[i] = 0;
Expand Down

0 comments on commit 9d5aa36

Please sign in to comment.