Tensorflow 運行警告提示 Your CPU supports instructions that this TensorFlow binary was not compiled to use


由於現在神經網絡這個東西比較火,准確的說是深度學習這個東西比較火,我們實驗室准備靠這個東西發幾個CCF A類的文章,雖然我不太懂這東西,興趣也一般都是畢竟要跟隨主流的,於是今天安裝起了 Tensorflow 這個深度學習的框架。

 

安裝好以后運行一個Demo ,如下:

import tensorflow as tf
a=tf.constant(2)
b=tf.constant(20)
 
 
with tf.Session() as sess:
    print(sess.run(a*b))

 

 

運行結果如下:

2018-05-03 19:57:44.151803: I tensorflow/core/platform/cpu_feature_guard.cc:137] Your CPU supports instructions that this TensorFlow binary was not compiled to use: SSE4.1 SSE4.2 AVX AVX2 FMA
2018-05-03 19:57:44.251905: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:892] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2018-05-03 19:57:44.252195: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1030] Found device 0 with properties:
name: GeForce GTX 1050 Ti major: 6 minor: 1 memoryClockRate(GHz): 1.62
pciBusID: 0000:01:00.0
totalMemory: 3.95GiB freeMemory: 3.65GiB
2018-05-03 19:57:44.252228: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1120] Creating TensorFlow device (/device:GPU:0) -> (device: 0, name: GeForce GTX 1050 Ti, pci bus id: 0000:01:00.0, compute capability: 6.1)
40

 

這么一堆東西,一塊就知道是沒有啥用的警告,當然這是要把那個結果排除的,本打算忽略,不過這么一條警告我覺得我還是應該研究一下,如下:

  Your CPU supports instructions that this TensorFlow binary was not compiled to use

 

這個警告是說我這個Tensorflow 不能支持幾種CPU矢量運算的指令碼,這東西看起來雖然是然並卵,但是總之是要人看着不太舒服,於是我上網找了找解法,發現大部分人是把警告直接屏蔽,方法如下:

1.

開頭輸入如下:

    import os

    os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'

 

不過這個法子總是有些不完美,於是繼續研究,得到第二個法子:

 

2. 進 tensorflow 官網,從源碼安裝

這個法子十分徹底,不過難度太大,這里不進行考慮。

 

 

 

 

3.   第三個方法,可能是我找到的比較靠譜的一個法子:

參考:https://blog.csdn.net/PJ7410/article/details/78886048

 

這里面說這個東西是要使你的Tensorflow 支持 SSE4.1 SSE4.2 AVX AVX2 FMA 指令,並給出了一個外國網址:

TensorFlow binaries supporting AVX, FMA, SSE etc.

 

由於我的個人電腦的配置,我選擇下面的安裝包:

 

下載到電腦上后,執行:

sudo pip install --ignore-installed --upgrade  tensorflow-1.6.0-cp27-cp27mu-linux_x86_64.whl

 

然后就是漫長的等待,此時此刻我也是等待中呀,稍后便知是否可行。

 

 

經過漫長的等待,大致花了一個小時左右的時間,終於搞定,所有的警告消息都沒有了,此法可行。

 

搞定


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM