# Help needed: GPU version slow at (likely) device setup

**URL:** <https://discuss.ai.google.dev/t/help-needed-gpu-version-slow-at-likely-device-setup/28952>\
**Category:** General Discussion\
**Tags:** gpu, keras, models, help\_request\
**Created:** [August 23, 2021, 3:19pm UTC](https://discuss.ai.google.dev/t/help-needed-gpu-version-slow-at-likely-device-setup/28952 "2021-08-23T15:19:25Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![adscft3](https://avatars.discourse-cdn.com/v4/letter/a/e8c25b/32.png) [@adscft3](https://discuss.ai.google.dev/u/adscft3)\
**Post date:** [August 23, 2021, 3:19pm UTC](https://discuss.ai.google.dev/t/help-needed-gpu-version-slow-at-likely-device-setup/28952/1 "2021-08-23T15:19:25Z")

</div>

I just got a new GPU and am trying out the GPU version of tensorflow. I installed it through conda

```auto
conda create -n tf-gpu tensorflow-gpu
conda activate tf-gpu

```

My little test script worked okay except that

```auto
model = tf.keras.models.Sequential([
  tf.keras.layers.Flatten(input_shape=(28,28)),
  tf.keras.layers.Dense(128, activation='relu'),
  tf.keras.layers.Dropout(0.2),
  tf.keras.layers.Dense(10)
])

```

takes quite a while. It prints out things like

```auto
2021-08-22 19:28:51.617228: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1862] Adding visible gpu devices: 0
2021-08-22 19:28:51.617263: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcudart.so.10.1
2021-08-22 19:34:08.926351: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1261] Device interconnect StreamExecutor with strength 1 edge matrix:
2021-08-22 19:34:08.926382: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1267] 0 
2021-08-22 19:34:08.926392: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1280] 0: N 

```

where as you can see it takes minutes before the “Device interconnect” line is printed.

The above Sequential line is done within a second if I ran the CPU version of tensorflow. Also the actually training of the network with the GPU version is only twice as fast as the CPU version.

I see that the conda tensorflow package comes with CUDA 10.1. I have CUDA 11.2 installed elsewhere. Not sure if that’s a problem or not.

Am I missing something in the setup of the GPU or elsewhere?

Thanks!

---

<div class="post-metadata">

**Author:** ![Bhack](https://d1dlmcr85iqnpo.cloudfront.net/user_avatar/discuss.ai.google.dev/bhack/32/6388_2.png) [@Bhack](https://discuss.ai.google.dev/u/Bhack)\
**Post date:** [August 23, 2021, 3:50pm UTC](https://discuss.ai.google.dev/t/help-needed-gpu-version-slow-at-likely-device-setup/28952/3 "2021-08-23T15:50:00Z")

</div>

Can you try to run this in our official GPU image:

> **[Docker  |  TensorFlow](https://www.tensorflow.org/install/docker)**

---

<div class="post-metadata">

**Author:** ![adscft3](https://avatars.discourse-cdn.com/v4/letter/a/e8c25b/32.png) [@adscft3](https://discuss.ai.google.dev/u/adscft3)\
**Post date:** [August 24, 2021, 7:47am UTC](https://discuss.ai.google.dev/t/help-needed-gpu-version-slow-at-likely-device-setup/28952/5 "2021-08-24T07:47:10Z")

</div>

I tried in the official tensorflow-gpu docker image and it worked okay there. This is probably a problem in the conda package.

Thanks!
