title: How do you free up gpu memory?
body: <p>When running theano, I get an error: not enough memory. See below.
  What are some possible actions that can be taken to free up memory?
  I know I can close applications etc, but I just want see if anyone has other ideas. For example, is it possible to reserve memory?</p>
  
  <blockquote>
    <p>THEANO_FLAGS=mode=FAST_RUN,device=gpu,floatX=float32 python 
    conv_exp.py Using gpu device 0: GeForce GT 650M Trying to run under a
    GPU.  If this is not desired, then modify network3.py to set the GPU
    flag to False. <strong>Error allocating 156800000 bytes of device memory (out
    of memory). Driver report 64192512 bytes free and 1073414144 bytes
    total</strong>  Traceback (most recent call last):   File "conv_exp.py", line
    25, in 
        training_data, validation_data, test_data = network3.load_data_shared()   File
    "/Users/xr/courses/deep_learning/con_nn/neural-networks-and-deep-learning/src/network3.py",
    line 78, in load_data_shared
        return [shared(training_data), shared(validation_data), shared(test_data)]   File
    "/Users/xr/courses/deep_learning/con_nn/neural-networks-and-deep-learning/src/network3.py",
    line 74, in shared
        np.asarray(data[0], dtype=theano.config.floatX), borrow=True)   File
    "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/theano/compile/sharedvalue.py",
    line 208, in shared
        allow_downcast=allow_downcast, **kwargs)   File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/theano/sandbox/cuda/var.py",
    line 203, in float32_shared_constructor
        deviceval = type_support_filter(value, type.broadcastable, False, None) MemoryError: ('Error allocating 156800000 bytes of device memory
    (out of memory).', "you might consider using 'theano.shared(...,
    borrow=True)'")</p>
  </blockquote>