title: Caffe: how to choose maximum avalible batch size that can fit in memory?
body: <p>I experienced some problems due small GPU memory (1Gb), the problem is that for now I choose <code>batch_size</code> by trial and error and it seems even if memory size printed in log by line <code>Memory required for data:</code> is less than 1Gb it can fail.</p>
  
  <p>So my questions are: </p>
  
  <ol>
  <li>How to automatically choose maximun availible batch size that can fit in GPU memory?</li>
  <li>Is it always better to have bigger <code>batch_size</code>?</li>
  <li>How calculate peak memory needed for training and forward pass during deploy of network?</li>
  </ol>
  
  <p><strong>UPDATE:</strong>
  Also I checked the <a href="https://github.com/BVLC/caffe/blob/843575eca2582fc30588ceaf31c987ad7707033d/src/caffe/net.cpp#L157" rel="nofollow">code</a> , but I'm not sure what is <a href="https://github.com/BVLC/caffe/blob/843575eca2582fc30588ceaf31c987ad7707033d/src/caffe/net.cpp#L154" rel="nofollow">top_vecs_</a></p>