Run nvidia-smi and see what process is using up all the memory. Possibly some previous session which is still active.

On 2 November 2017 at 14:37, Andreas Kloeckner <> wrote:
Arnold Tunick <> writes:
>  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\", 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 and 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
> or
>    import gc
>    and between calls add gc.collect().Please advise.Thank you.Arnold

Is there other code in that program that might also create a context?
Contexts are quite memory-intensive, so your device may not have enough
memory to fit more than one.


PyCUDA mailing list