https://www.tensorflow.org/install
https://www.tensorflow.org/install/gpu
-
Install Visual Studion 2017 Free Version and C++ Redistributable:
-
Install CUDA Toolkit 10.1 https://developer.nvidia.com/cuda-toolkit-archive
-
Install NVIDIA cuDNN version 7 https://developer.nvidia.com/cudnn
Download (you need an account) and copy the dll, include, and lib files in the corresponding directories of the CUDA Toolkit installation directory
- On Windows: Modify environment variables (paths must match your installation directory):
- Add variable
CUDA_PATH = C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\bin
Add 2 entries to PATH variable:
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\bin
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\libnvvp
- Create a virtual environment and activate it (e.g. with conda or virtualenv)
conda create -n tf python=3.8
conda activate tf
- Install with
pip install tensorflow
import tensorflow as tf
print(tf.__version__)
# test gpu
physical_devices = tf.config.list_physical_devices("GPU")
print(len(physical_devices))