Raymond Lucky
Raymond Lucky

Reputation: 63

By default, does TensorFlow use GPU/CPU simultaneously for computing or GPU only?

By default, TensorFlow will use our available GPU devices. That said, does TensorFlow use GPUs and CPUs simultaneously for computing, or GPUs for computing and CPUs for job handling (no matter how, CPUs are always active, as I think)?

Upvotes: 4

Views: 5933

Answers (3)

mcatoen
mcatoen

Reputation: 131

TensorFlow operations come packaged with a list of devices they can execute on and a list of associated priorities.

For example, a convolution is very conducive to computation on a GPU; but can still be done on a CPU whereas scalar additions should definitely be done on a CPU. You can override this selection using tf.Device and the key attached to the device of interest.

Upvotes: 1

Dr. Snoopy
Dr. Snoopy

Reputation: 56357

Generally it uses both, the CPU and the GPU (assuming you are using a GPU-enabled TensorFlow). What actually gets used depends on the actual operations that your code is using.

For each operation available in TensorFlow, there are several "implementations" of such operation, generally a CPU implementation and a GPU one. Some operations only have CPU implementations as it makes no sense for a GPU implementation, but overall most operations are available for both devices.

If you make custom operations then you need to provide implementations that you want.

Upvotes: 4

Rick Standaert
Rick Standaert

Reputation: 98

Someone correct me if I'm wrong.

But from what I'm aware TensorFlow only uses either GPU or CPU depending on what installation you ran. For example if you used pip install TensorFlow for python 2 or python3 -m pip install TensorFlow for python 3 you'll only use the CPU version.

Vise versa for GPU.

If you still have any questions or if this did not correctly answer your question feel free to ask me more.

Upvotes: -2

Related Questions