<h3 dir="auto">System information</h3>
<ul dir="auto">
<li><strong>Have I written custom code (as opposed to using a stock example script provided in TensorFlow)</strong>: Barely. See below.</li>
<li><strong>OS Platform and Distribution (e.g., Linux Ubuntu 16.04)</strong>: Windows 10, Version 10.0.17134.285.</li>
<li><strong>TensorFlow installed from (source or binary)</strong>: Binary.</li>
<li><strong>TensorFlow version (use command below)</strong>: b'v1.11.0-rc2-4-gc19e29306c' 1.11.0.</li>
<li><strong>Python version</strong>: Python 3.6.6 (v3.6.6:4cf1f54eb7, Jun 27 2018, 03:37:03) [MSC v.1900 64 bit (AMD64)] on win32.</li>
<li><strong>CUDA/cuDNN version</strong>: CUDA V9.0.176, cuDNN v7.3.1.</li>
<li><strong>GPU model and memory</strong>: Nvidia GTX 970 4 GB.</li>
</ul>
<h3 dir="auto">Reproduction</h3>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="import tensorflow as tf
print(tf.test.is_gpu_available())"><pre class="notranslate"><code class="notranslate">import tensorflow as tf
print(tf.test.is_gpu_available())
</code></pre></div>
<h3 dir="auto">Expected behaviour</h3>
<p dir="auto">Test prints <code class="notranslate">True</code>.</p>
<h3 dir="auto">Actual behaviour</h3>
<p dir="auto">The test script prints the following text and then hangs indefinitely, using 100% of one CPU core:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="&gt;&gt;&gt; tf.test.is_gpu_available()

2018-10-03 23:08:26.805592: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2

2018-10-03 23:08:27.171992: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1411] Found device 0 with properties:

name: GeForce GTX 970 major: 5 minor: 2 memoryClockRate(GHz): 1.253

pciBusID: 0000:01:00.0

totalMemory: 4.00GiB freeMemory: 3.31GiB

2018-10-03 23:08:27.184134: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1490] Adding visible gpu devices: 0"><pre class="notranslate"><code class="notranslate">&gt;&gt;&gt; tf.test.is_gpu_available()

2018-10-03 23:08:26.805592: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2

2018-10-03 23:08:27.171992: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1411] Found device 0 with properties:

name: GeForce GTX 970 major: 5 minor: 2 memoryClockRate(GHz): 1.253

pciBusID: 0000:01:00.0

totalMemory: 4.00GiB freeMemory: 3.31GiB

2018-10-03 23:08:27.184134: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1490] Adding visible gpu devices: 0
</code></pre></div>
<h3 dir="auto">System information</h3>
<ul dir="auto">
<li><strong>Have I written custom code (as opposed to using a stock example script provided in TensorFlow)</strong>: No</li>
<li><strong>OS Platform and Distribution (e.g., Linux Ubuntu 16.04)</strong>: Linux Ubuntu 16.04</li>
<li><strong>Mobile device (e.g. iPhone 8, Pixel 2, Samsung Galaxy) if the issue happens on mobile device</strong>: N/A</li>
<li><strong>TensorFlow installed from (source or binary)</strong>:  1.10.0-devel-gpu-py3</li>
<li><strong>TensorFlow version (use command below)</strong>: 1.10.0-devel-gpu-py3</li>
<li><strong>Python version</strong>: 3.5.2</li>
<li><strong>Bazel version (if compiling from source)</strong>: N/A</li>
<li><strong>GCC/Compiler version (if compiling from source)</strong>: N/A</li>
<li><strong>CUDA/cuDNN version</strong>: CUDA: V9.0.176 cuDNN: V7.1.4</li>
<li><strong>GPU model and memory</strong>: 2x 1080ti 11GB</li>
<li><strong>Exact command to reproduce</strong>:</li>
</ul>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="import tensorflow as tf

data_format = 'channels_first' if tf.test.is_gpu_available(True) \
    else 'channels_last'
# At this point, all memory is allocated across all GPUs
config = tf.ConfigProto()
config.gpu_options.allow_growth = True
sess = tf.Session(config=config)
# All VRAM still allocated"><pre class="notranslate"><code class="notranslate">import tensorflow as tf

data_format = 'channels_first' if tf.test.is_gpu_available(True) \
    else 'channels_last'
# At this point, all memory is allocated across all GPUs
config = tf.ConfigProto()
config.gpu_options.allow_growth = True
sess = tf.Session(config=config)
# All VRAM still allocated
</code></pre></div>
<h3 dir="auto">Describe the problem</h3>
<p dir="auto">Using tf.test.is_gpu_available(True) to check if a system GPU is available allocates all the VRAM available.</p>