構成tensor 2 tensorはGPUの上で運行します
5067 ワード
1.tensor 2 tensorがGPU上で動作する簡単なまとめ
import tensorflow as tf
with tf.device('/device:GPU:0'):
a = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[2, 3], name='a')
b = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[3, 2], name='b')
c = tf.matmul(a, b)
sess = tf.Session()
sess.run(c)
2.condaを使用してtensor 2 tensorをインストールする
# conda
conda create --name PY368 python==3.6.8
conda activate PY368
conda install pip
pip install tf-nightly-gpu # preview
pip install tensor2tensor[tensorflow_gpu]
# cuda # cudnn
cat /usr/local/cuda/version.txt
cat /usr/local/cuda/include/cudnn.h | grep CUDNN_MAJOR -A 2
# tensorflow cuda10.1
conda search cuda
conda install cudatoolkit==10.0.130
# GPU
watch -n1 nvidia-smi
# sshd_config
sudo echo "GatewayPorts yes" >> /etc/ssh/sshd_config
systemctl restart sshd # ssh
# , , , tensorboard ,
ssh -qTfNn -R '[::]:10036:localhost:6006' [email protected]( ip)