Hi Andreas,
     my CNN training program has the following pycuda set up:

    import pycuda.driver as drv
...
    # pycuda set up
    drv.init()
    dev = drv.Device(int(config['gpu'][-1]))
    ctx = dev.make_context()

When I run the program I get the following error:
 
File "C:\Users\atunick\theano_alexnet\train.py", line 31, in train_net
    ctx = dev.make_context()
MemoryError: cuCtxCreate failed: out of memory

Note that I am using a new win 10 notebook and have everything re-installed and working, e.g., I have run without error two pycuda test programs...hello_gpu.py and simplespeedtest.py.
.
I have not seen this problem before and when I search the web for solutions, the ones that you recommended earlier don't appear to work, i.e.,
   import pycuda
   pycuda.tools.clear_context_caches()
or
   import gc
   and between calls add gc.collect()
.
Please advise.
Thank you.
Arnold