Ubuntu 22.04
Sponsored Link

TensorFlow : インストール2022/09/08

 
機械学習ライブラリー, TensorFlow をインストールします。
[1]
[2]
[3] cuDNN (CUDA Deep Neural Network library)、および、その他必要なパッケージをインストールしておきます。
root@dlp:~#
apt -y install nvidia-cudnn python3-pip python3-dev python3-venv gcc g++ make

[4] 任意の一般ユーザーでログインして、TensorFlow インストール用の Python 仮想環境を準備します。
ubuntu@dlp:~$
python3 -m venv --system-site-packages ~/tensorflow

ubuntu@dlp:~$
source ~/tensorflow/bin/activate

(tensorflow) ubuntu@dlp:~$
[5] TensorFlow 2.9 をインストールします。
(tensorflow) ubuntu@dlp:~$
pip3 install --upgrade tensorflow==2.9.0
# TensorFlow 動作確認

(tensorflow) ubuntu@dlp:~$
python3 -c "import tensorflow as tf;print(tf.reduce_sum(tf.random.normal([1000, 1000])))"

2022-09-08 04:40:48.411169: 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 04:40:48.481549: 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 04:40:48.482004: 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 04:40:48.482920: 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 04:40:48.483404: 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 04:40:48.483781: 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 04:40:48.484111: 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 04:40:49.082588: 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 04:40:49.082927: 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 04:40:49.083118: 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 04:40:49.083407: 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(637.8404, shape=(), dtype=float32)
関連コンテンツ