Cap tensorflow batch size based on GPU memory

401 Views Asked by At

I am switching to training on GPUs and found that with arbitrary, and not very big, batch size of training will crash. With 256x256 RGB images in a UNET, a batch of 32 causes an out of memory crash, while 16 works successfully. The amount of memory consumed was surprising as I never ran into an out-of-memory on a 16 GB RAM system. Is tensorflow free to use SWAP?

How can I check the amount of total memory available on a GPU? Many guides online only look at memory used.

How does one estimate the memory needs? Image size (pixelschannelsdtype)* batch + parameter size * float?

Many thanks, Bogdan

0

There are 0 best solutions below