question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Installation with both CPU/GPU tensorflow modules

See original GitHub issue

It is said in the document that keras will automatically run on GPU with tensorflow backend.

However, I found Keras depends on the installation order of tensorflow modules. It seems that keras always use the module installed last. For example,

pip install tensorflow-gpu tensorflow

Keras will use CPU under this circumenstance.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:16
  • Comments:12 (1 by maintainers)

github_iconTop GitHub Comments

11reactions
austinmwcommented, Dec 8, 2018

Is there any way to get the above solution to work from a tensorflow-gpu container? TF fails to import using this container on a non-gpu machine. It’d be nice to be able to use the same docker image for both machine types.

7reactions
ziky90commented, Jun 15, 2017

I have experimented with this a bit on my machine as well and it seems to me that the default behaviour working directly with tensorflow==1.1.0 is following:

If I perform the installation in the following order:

sudo pip install tensorflow
sudo pip install tensorflow-gpu

then GPU version is being used But if I install it in the opposite order:

sudo pip install tensorflow-gpu
sudo pip install tensorflow

then CPU version is being used.

I have performed the experiment not using keras, just importing tensorflow directly (the same way keras does it in the tensorflow backend module). And I have installed it directly to the root python 2.7. on Ubuntu 16.04.2.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Install TensorFlow with pip
Step-by-step instructions · 1. System requirements · 2. Install Miniconda · 3. Create a conda environment · 4. GPU setup · 5. Install...
Read more >
CPU and GPU Tensorflow Installation - Stack Overflow
If you have tensorflow-gpu installed there really isn't any reason to also have tensorflow. Without the presence of a gpu it will just...
Read more >
Installation - TensorFlow 2 Object Detection API tutorial
There are two different variations of TensorFlow that you might wish to install, depending on whether you would like TensorFlow to run on...
Read more >
How to Install TensorFlow with GPU Support on Windows 10 ...
Note: I used the same procedure for doing the CPU version. I created a new "env" naming it "tf-CPU" and installed the CPU...
Read more >
TensorFlow on the HPC Clusters
ssh <YourNetID>@della.princeton.edu # or adroit, tigergpu $ module load anaconda3/2022.5 ... TensorFlow 2.x for multicore CPUs can be installed as follows:
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found