TensorFlow : Install (GPU Support) |
Install TensorFlow which is the Machine Learning Library. On this example, Setup TensorFlow to use NVIDIA GPU on your computer. | |
| [1] | |
| [2] | |
| [3] | Download cuDNN (CUDA Deep Neural Network library) from the NVIDIA official site. (it needs to register a developer account) ⇒ https://developer.nvidia.com/rdp/cudnn-download |
| [4] | Upload cuDNN to your Server and locate files like follows. |
| [root@dlp ~]# tar Jxvf cudnn-linux-x86_64-8.5.0.96_cuda11-archive.tar.xz [root@dlp ~]# cp ./cudnn-linux-x86_64-8.5.0.96_cuda11-archive/include/cudnn.h /usr/local/cuda/include/ [root@dlp ~]# cp -a ./cudnn-linux-x86_64-8.5.0.96_cuda11-archive/lib/libcudnn* /usr/local/cuda/lib64/ [root@dlp ~]# ldconfig |
| [5] | Install other required packages. For Cudart (CUDA Runtime native runtime libraries), it also needs for CUDA 11.7, so install it, too. |
| [root@dlp ~]# dnf -y install python3-devel gcc gcc-c++ make cuda-cudart-11-7 |
| [6] | Login as a common user and prepare Python virtual environment to install TensorFlow. If you'd like to install it on System Wide, skip this section and execute the next [7] with root user account. |
| [cent@dlp ~]$ python3 -m venv --system-site-packages ~/tensorflow [cent@dlp ~]$ source ./tensorflow/bin/activate (tensorflow) [cent@dlp ~]$ |
| [7] | Install TensorFlow 2.9. |
(tensorflow) [cent@dlp ~]$ pip3 install --upgrade tensorflow==2.9 # verify to run TensorFlow (tensorflow) [cent@dlp ~]$ python3 -c "from tensorflow.python.client import device_lib; device_lib.list_local_devices()" 2022-09-08 16:29:00.277591: I tensorflow/core/platform/cpu_feature_guard.cc:193] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations: AVX2 FMA To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags. 2022-09-08 16:29:00.611075: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:975] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero 2022-09-08 16:29:00.683287: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:975] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero 2022-09-08 16:29:00.683779: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:975] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero 2022-09-08 16:29:01.208884: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:975] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero 2022-09-08 16:29:01.209379: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:975] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero 2022-09-08 16:29:01.209824: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:975] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero 2022-09-08 16:29:01.210231: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1532] Created device /device:GPU:0 with 5391 MB memory: -> device: 0, name: NVIDIA GeForce GTX 1060 6GB, pci bus id: 0000:05:00.0, compute capability: 6.1(tensorflow) [cent@dlp ~]$ python3 -c "import tensorflow as tf;print(tf.reduce_sum(tf.random.normal([1000, 1000])))" 2022-09-08 16:29:41.366784: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:975] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero 2022-09-08 16:29:41.404263: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:975] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero 2022-09-08 16:29:41.404724: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:975] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero 2022-09-08 16:29:41.405501: I tensorflow/core/platform/cpu_feature_guard.cc:193] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations: AVX2 FMA To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags. 2022-09-08 16:29:41.406096: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:975] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero 2022-09-08 16:29:41.406473: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:975] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero 2022-09-08 16:29:41.406812: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:975] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero 2022-09-08 16:29:41.906749: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:975] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero 2022-09-08 16:29:41.907205: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:975] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero 2022-09-08 16:29:41.907692: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:975] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero 2022-09-08 16:29:41.908107: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1532] Created device /job:localhost/replica:0/task:0/device:GPU:0 with 5391 MB memory: -> device: 0, name: NVIDIA GeForce GTX 1060 6GB, pci bus id: 0000:05:00.0, compute capability: 6.1 tf.Tensor(-277.11124, shape=(), dtype=float32) |
No comments:
Post a Comment