TensorFlow all of the full GPU resources by default

Source: Internet
Author: User

A server is loaded with multiple GPUs, and by default, when a deep learning training task is started, this task fills up almost all of the storage space for each GPU. This results in the fact that a server can only perform a single task, while the task may not require so many resources, which is tantamount to a waste of resources.

The following solutions are available for this issue.

First, directly set the visible GPU

Write a script that sets environment variables

export CUDA_VISIBLE_DEVICES=0python model.py
Second, set the storage limit for each GPU
gpu_options = tf.GPUOptions(per_process_gpu_memory_fraction=0.333)sess = tf.Session(config=tf.ConfigProto(gpu_options=gpu_options))
Iii. incremental use of GPU storage
config = tf.ConfigProto()config.gpu_options.allow_growth=Truesess = tf.Session(config=config)

TensorFlow all of the full GPU resources by default

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.