Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does one calculate the GPU memory required to run a model in TensorFlow?

Is there a straightforward way to find the GPU memory consumed by, say, an inception-resnet-v2 model that is initialized in tensorflow? This includes the inference and the backprop memories required.

like image 896
kwotsin Avatar asked Dec 10 '16 05:12

kwotsin


People also ask

How much GPU is required for TensorFlow?

TensorFlow (TF) GPU 1.6 and above requires cuda compute capability (ccc) of 3.5 or higher and requires AVX instruction support.

How does TensorFlow allocate GPU memory?

By default, TensorFlow maps nearly all of the GPU memory of all GPUs (subject to CUDA_VISIBLE_DEVICES ) visible to the process. This is done to more efficiently use the relatively precious GPU memory resources on the devices by reducing memory fragmentation. To limit TensorFlow to a specific set of GPUs we use the tf.

How much memory do you need for GPU machine learning?

The average memory requirement is 16GB of RAM, but some applications require more memory. A massive GPU is typically understood to be a "must-have", but thinking through the machine learning memory requirements probably doesn't weigh into that purchase. However, it can make or break your application performance.

How do you calculate GPU?

HOW TO CALCULATE GPU PERFORMANCE (RDNA 2 based) ROPS * Clock Speed = Fill Rate TMU * Clock Speed = Texture Fill Rate & RT perf (PEAK) CU * 64 * Clock Speed * 2 = TFLOPS (FP32 Perf) For XSX this gives 116Gpixel (Fill Rate), 380(texture / RT), & 12.1TFLOPS.


1 Answers

You can explicitly calculate the memory needed to store parameters, but I am afraid it would be difficult to compute the size of all buffers needed for training. Probably, a more clever way would be to make TF do it for you. Set the gpu_options.allow_growth config option to True and see how much does it consume. Another option is to try smaller values for gpu_options.per_process_gpu_memory_fraction until it fails with out of memory.

like image 72
Dmytro Prylipko Avatar answered Oct 15 '22 05:10

Dmytro Prylipko