Skip to content

Commit

Permalink
Merge pull request BVLC#2016 from shelhamer/share-col-buffer
Browse files Browse the repository at this point in the history
Share convolution buffers to reduce memory usage

* shelhamer/share-col-buffer:
  share columnation buffers for convolution to save memory
  • Loading branch information
shelhamer committed Mar 4, 2016
2 parents 7135e3c + 839b050 commit 4ef1c45
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 3 additions & 1 deletion include/caffe/layers/base_conv_layer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,9 @@ class BaseConvolutionLayer : public Layer<Dtype> {
int col_offset_;
int output_offset_;

Blob<Dtype> col_buffer_;
// N.B. sharing the col buffer reduces memory but interferes with
// ND conv and parallelism
static Blob<Dtype> col_buffer_;
Blob<Dtype> bias_multiplier_;
};

Expand Down
3 changes: 3 additions & 0 deletions src/caffe/layers/base_conv_layer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@

namespace caffe {

template <typename Dtype>
Blob<Dtype> BaseConvolutionLayer<Dtype>::col_buffer_;

template <typename Dtype>
void BaseConvolutionLayer<Dtype>::LayerSetUp(const vector<Blob<Dtype>*>& bottom,
const vector<Blob<Dtype>*>& top) {
Expand Down

0 comments on commit 4ef1c45

Please sign in to comment.