久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

為什么在 conda 安裝后 Tensorflow 無法識別我的 GP

Why is Tensorflow not recognizing my GPU after conda install?(為什么在 conda 安裝后 Tensorflow 無法識別我的 GPU?)
本文介紹了為什么在 conda 安裝后 Tensorflow 無法識別我的 GPU?的處理方法,對大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

問題描述

我是深度學(xué)習(xí)的新手,過去 2 天我一直在嘗試在我的電腦上安裝 tensorflow-gpu 版本,但徒勞無功.我避免安裝 CUDA 和 cuDNN 驅(qū)動程序,因?yàn)橛捎谠S多兼容性問題,一些在線論壇不推薦它.由于我之前已經(jīng)在使用 python 的 conda 發(fā)行版,所以我選擇了 conda install -c anaconda tensorflow-gpu,在他們的官方網(wǎng)站上寫著:https://anaconda.org/anaconda/tensorflow-gpu .

I am new to deep learning and I have been trying to install tensorflow-gpu version in my pc in vain for the last 2 days. I avoided installing CUDA and cuDNN drivers since several forums online don't recommend it due to numerous compatibility issues. Since I was already using the conda distribution of python before, I went for the conda install -c anaconda tensorflow-gpu as written in their official website here: https://anaconda.org/anaconda/tensorflow-gpu .

然而,即使在新的虛擬環(huán)境中安裝了 gpu 版本(為了避免與基礎(chǔ)環(huán)境中 pip 安裝的庫發(fā)生潛在沖突),tensorflow 似乎出于某種神秘原因甚至無法識別我的 GPU.

However even after installing the gpu version in a fresh virtual environment (to avoid potential conflicts with pip installed libraries in the base env), tensorflow doesn't seem to even recognize my GPU for some mysterious reason.

我運(yùn)行的一些代碼片段(在 anaconda 提示符中)以了解它無法識別我的 GPU:-

Some of the code snippets I ran(in anaconda prompt) to understand that it wasn't recognizing my GPU:-

1.

>>>from tensorflow.python.client import device_lib
        >>>print(device_lib.list_local_devices())
                    [name: "/device:CPU:0"
                device_type: "CPU"
                memory_limit: 268435456
                locality {
                }
                incarnation: 7692219132769779763
                ]

如您所見,它完全忽略了 GPU.

As you can see it completely ignores the GPU.

2.

>>>tf.debugging.set_log_device_placement(True)
    >>>a = tf.constant([[1.0, 2.0, 3.0], [4.0, 5.0, 6.0]])
2020-12-13 10:11:30.902956: I tensorflow/core/platform/cpu_feature_guard.cc:142] This 
TensorFlow 
binary is optimized with oneAPI Deep Neural Network Library (oneDNN)to use the following CPU 
instructions in performance-critical operations:  AVX AVX2
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
>>>b = tf.constant([[1.0, 2.0], [3.0, 4.0], [5.0, 6.0]])
>>>c = tf.matmul(a, b)
>>>print(c)
tf.Tensor(
[[22. 28.]
[49. 64.]], shape=(2, 2), dtype=float32)

在這里,它應(yīng)該通過顯示 Executing op MatMul in device/job:localhost/replica:0/task:0/device:GPU:0 來表明它使用 GPU 運(yùn)行(如寫在這里:https://www.tensorflow.org/guide/gpu) 但沒有那樣的存在.我也不確定第二行之后的消息是什么意思.

Here, it was supposed to indicate that it ran with a GPU by showing Executing op MatMul in device /job:localhost/replica:0/task:0/device:GPU:0 (as written here: https://www.tensorflow.org/guide/gpu) but nothing like that is present. Also I am not sure what the message after the 2nd line means.

我也在網(wǎng)上搜索了幾個解決方案,包括這里,但是幾乎所有的問題都與第一種手動安裝方法有關(guān),因?yàn)榇蠹叶纪扑]這種方法,所以我還沒有嘗試過.

I have also searched for several solutions online including here but almost all of the issues are related to the first manual installation method which I haven't tried yet since everyone recommended this approach.

我不再使用 cmd,因?yàn)樵趶幕?env 卸載 tensorflow-cpu 并重新安裝后,環(huán)境變量以某種方式搞砸了,它與 anaconda 提示符完美配合,但不是 cmd.這是一個單獨(dú)的問題(也很普遍),但我提到了它,以防它在這里發(fā)揮作用.我在一個全新的虛擬環(huán)境中安裝了 gpu 版本以確保安裝干凈,據(jù)我所知,路徑變量只需要為手動安裝 CUDA 和 cuDNN 庫設(shè)置.

I don't use cmd anymore since the environment variables somehow got messed up after uninstalling tensorflow-cpu from the base env and on re-installing, it worked perfectly with anaconda prompt but not cmd. This is a separate issue (and widespread also) but I mentioned it in case that has a role to play here. I installed the gpu version in a fresh virtual environment to ensure a clean installation and as far as I understand path variables need to be set up only for manual installation of CUDA and cuDNN libraries.

我使用的卡:-(啟用了 CUDA)

The card which I use:-(which is CUDA enabled)

C:WINDOWSsystem32>wmic path win32_VideoController get name
Name
NVIDIA GeForce 940MX
Intel(R) HD Graphics 620

我目前使用的 Tensorflow 和 python 版本:-

Tensorflow and python version I am using currently:-

>>> import tensorflow as tf
>>> tf.__version__
'2.3.0'

Python 3.8.5 (default, Sep  3 2020, 21:29:08) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.

系統(tǒng)信息:Windows 10 Home、64 位操作系統(tǒng)、基于 x64 的處理器.

System information: Windows 10 Home, 64-bit operating system, x64-based processor.

任何幫助將不勝感激.提前致謝.

Any help would be really appreciated. Thanks in advance.

推薦答案

2021 年 8 月 Conda install 現(xiàn)在可能正在運(yùn)行,根據(jù)@ComputerScientist 在下面的評論中,conda install tensorflow-gpu==2.4.1 將給出 cudatoolkit-10.1.243cudnn-7.6.5

August 2021 Conda install may be working now, as according to @ComputerScientist in the comments below, conda install tensorflow-gpu==2.4.1 will give cudatoolkit-10.1.243 and cudnn-7.6.5

以下內(nèi)容寫于 2021 年 1 月,已過時

目前 conda install tensorflow-gpu 安裝 tensorflow v2.3.0 并且不安裝 conda cudnn 或 cudatoolkit 包.手動安裝它們(例如,使用 conda install cudatoolkit=10.1)似乎也不能解決問題.

Currently conda install tensorflow-gpu installs tensorflow v2.3.0 and does NOT install the conda cudnn or cudatoolkit packages. Installing them manually (e.g. with conda install cudatoolkit=10.1) does not seem to fix the problem either.

解決方案是安裝較早版本的 tensorflow,它會安裝 cudnn 和 cudatoolkit,然后使用 pip 升級

A solution is to install an earlier version of tensorflow, which does install cudnn and cudatoolkit, then upgrade with pip

conda install tensorflow-gpu=2.1
pip install tensorflow-gpu==2.3.1

(2.4.0 使用 cuda 11.0 和 cudnn 8.0,但截至 2020 年 12 月 16 日 cudnn 8.0 不在 anaconda 中)

(2.4.0 uses cuda 11.0 and cudnn 8.0, however cudnn 8.0 is not in anaconda as of 16/12/2020)

另請參閱@GZ0 的答案,該答案鏈接到 github 討論,其中包含單行解決方案

please also see @GZ0's answer, which links to a github discussion with a one-line solution

這篇關(guān)于為什么在 conda 安裝后 Tensorflow 無法識別我的 GPU?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

Troubles while parsing with python very large xml file(使用 python 解析非常大的 xml 文件時出現(xiàn)問題)
Find all nodes by attribute in XML using Python 2(使用 Python 2 在 XML 中按屬性查找所有節(jié)點(diǎn))
Python - How to parse xml response and store a elements value in a variable?(Python - 如何解析 xml 響應(yīng)并將元素值存儲在變量中?)
How to get XML tag value in Python(如何在 Python 中獲取 XML 標(biāo)記值)
How to correctly parse utf-8 xml with ElementTree?(如何使用 ElementTree 正確解析 utf-8 xml?)
Parse XML from URL into python object(將 XML 從 URL 解析為 python 對象)
主站蜘蛛池模板: 综合婷婷 | 91在线精品秘密一区二区 | 欧美日韩久久精品 | 日韩手机视频 | 午夜免费网站 | 日本不卡视频在线播放 | 五月婷六月丁香 | 欧美日韩国产一区二区三区不卡 | 日韩福利 | 欧美激情精品久久久久久 | 日韩亚洲一区二区 | 久久久一区二区三区四区 | 女同久久 | 精品国产精品三级精品av网址 | 国产精品视频久久 | 国产精品99久久久久久久久 | 欧美成人精品激情在线观看 | 久久伊人精品 | 国产欧美在线一区 | 日韩高清中文字幕 | 亚洲国产精品久久久久秋霞不卡 | 天堂久久网| 亚洲毛片| 国产精品久久久 | 91在线观看 | 国产精品毛片av | 欧美成视频 | 美女国产精品 | 孕妇一级毛片 | 国产欧美日韩综合精品一区二区 | 99久久精品国产麻豆演员表 | 成人在线一区二区 | 日韩亚洲一区二区 | 欧美一区在线视频 | 精品国产久 | aaa一区| 999久久久免费精品国产 | 一级黄色片日本 | 国产精品xxxx| 国产在线精品一区二区 | www.一级片 |