TensorFlow GPU

TensorFlow GPU

一、TensorFlow-GPU環(huán)境配置

0.查看自己的顯卡是否支持GPU計(jì)算加速

顯卡查看:https://www.geforce.com/hardware/technology/cuda/supported-gpus
CUDA安裝:https://www.cnblogs.com/wanyu416/p/9536853.html
cuDNN下載:https://developer.nvidia.com/cudnn

1.安裝TensorFlow-GPU

pip install -i https://pypi.tuna.tsinghua.edu.cn/simple/ TensorFlow-GPU

2.安裝時(shí)出現(xiàn)ERROR: Cannot uninstall 'wrapt'問題的解決方案

pip install -U --ignore-installed wrapt enum34 simplejson netaddr
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple --upgrade tensorflow-gpu

3.導(dǎo)入時(shí)出現(xiàn)ImportError: Could not find 'cudart64_100.dll'問題的解決方案

https://blog.csdn.net/qq_29027865/article/details/93236034

4.查看設(shè)備信息

https://blog.csdn.net/qq_34022601/article/details/90449789

import os
from tensorflow.python.client import device_lib
os.environ["TF_CPP_MIN_LOG_LEVEL"] = "99"
 
if __name__ == "__main__":
    print(device_lib.list_local_devices())

二、使用GPU加速計(jì)算

1.指定計(jì)算設(shè)備

with tf.device('/gpu:0'):
    需要加速計(jì)算圖節(jié)點(diǎn)

2.初始化cuDNN

init = tf.global_variables_initializer()

config = tf.ConfigProto()
config.gpu_options.allow_growth = True
session = tf.Session(config=config)

session.run(init)
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容