Читать книгу Deep Learning for Physical Scientists - Edward O. Pyzer-Knapp - Страница 14
2.3.2.1.2 With GPU
ОглавлениеTo make use of TensorFlow's GPU acceleration, you will need to ensure that you have a compute unified device architecture (CUDA)‐capable GPU and all of the required drivers installed on your system. More information on setting up your system for GPU support can be found here: https://www.tensorflow.org/install/gpu
If you are using Linux, you can greatly simplify the configuration process by using the TensorFlow Docker image with GPU support: https://www.tensorflow.org/install/docker
Once you have the prerequisites installed, you can install TensorFlow via:
$> pip install tensorflow
We recommend sticking to conda install commands to ensure package compatibility with your conda environment, however a few earlier examples made use of TensorFlow 1's low‐level application programming interface (API) to illustrate lower‐level concepts. For compatibility, the earlier low‐level API can be used by including the following at the top of your script:
import tensorflow.compat.v1 as tf tf.compat.v1.disable_eager_execution()
This has been included in the code examples wherever necessary.
Note: with the latest version of TensorFlow, this command will install TensorFlow with both CPU and GPU (if available) support.