TensorFlow關於 SSE AVX的Warning問題

從谷歌下載TensorFlow使用,在測試使用過程中,每次運行代碼,都會輸出一大堆的warning信息(見本文的最後部分),其大致意思是:本機CPU架構支持SSE、AVX等加速指令,而當前使用的TensorFlow庫並沒有充分利用這些指令集,如果能夠使用開啓了這些指令集的TensorFlow版本,則可以提高TensorFlow的執行效率。
就目前而言,查閱了谷歌的相關文檔,提供的TensorFlow庫還相對單一,沒喲開啓這麼多指令集支持,其主要考慮的是讓這些release版本的TensorFlow庫可以安裝在更多的計算機中使用,因爲有很多老架構的cpu並不支持高級的指令集,比如AVX。
因此,如果想充分利用SSE和AVX來加速TensorFlow的CPU版本的運算,需要自己編譯TensorFlow的源碼。
另外,在StackOverflow中也找到了網友提供的用於暫時屏蔽這些warning輸出的辦法,如下:

import os
os.environ['TF_CPP_MIN_LOG_LEVEL']='2'
import tensorflow as tf

——————————-TensorFlow輸出的關於CPU指令集SSE、AVX的warning信息————————————-

2017-08-01 17:14:18.620000: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.1 instructions, but these are available on your machine and could speed up CPU computations.
2017-08-01 17:14:18.620138: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.2 instructions, but these are available on your machine and could speed up CPU computations.
2017-08-01 17:14:18.620223: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX instructions, but these are available on your machine and could speed up CPU computations.
2017-08-01 17:14:18.620243: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX2 instructions, but these are available on your machine and could speed up CPU computations.
2017-08-01 17:14:18.620259: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use FMA instructions, but these are available on your machine and could speed up CPU computations.
[array([ 14.], dtype=float32)]
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章