2013-02-15 81 views
4

我試圖從C++ SSE3指令集未啓用

http://www.cs.au.dk/~asand/?page_id=152 

在C工作的一些隱馬爾可夫代碼++使用HMMlib庫我使用的是Ubuntu的12.04,與GCC/G ++ 4.6

我的編譯步驟的指令是:

g++ -I/usr/local/boost_1_52_0 -I../ MAIN.cpp 

這將產生以下錯誤:

In file included from ../HMMlib/allocator_traits.hpp:25:0, 
      from ../HMMlib/hmm_table.hpp:25, 
      from MAIN.cpp:1: 
/usr/lib/gcc/i686-linux-gnu/4.6/include/pmmintrin.h:32:3: error: #error "SSE3  instruction set not enabled" 
In file included from ../HMMlib/hmm_table.hpp:25:0, 
      from MAIN.cpp:1: 
../HMMlib/allocator_traits.hpp:50:33: error: ‘__m128d’ was not declared in this scope 
../HMMlib/allocator_traits.hpp:50:40: error: template argument 2 is invalid 
../HMMlib/allocator_traits.hpp:77:32: error: ‘__m128’ was not declared in this scope 
../HMMlib/allocator_traits.hpp:77:38: error: template argument 2 is invalid 
In file included from ../HMMlib/hmm_table.hpp:26:0, 
      from MAIN.cpp:1: 
../HMMlib/operator_traits.hpp:112:32: error: ‘__m128d’ was not declared in this scope 
../HMMlib/operator_traits.hpp:112:39: error: template argument 2 is invalid 
../HMMlib/operator_traits.hpp:205:31: error: ‘__m128’ was not declared in this scope 
../HMMlib/operator_traits.hpp:205:37: error: template argument 2 is invalid 
In file included from ../HMMlib/hmm_table.hpp:27:0, 
      from MAIN.cpp:1: 
../HMMlib/float_traits.hpp:37:13: error: ‘__m128’ does not name a type 
../HMMlib/float_traits.hpp:43:13: error: ‘__m128d’ does not name a type 
In file included from ../HMMlib/hmm.hpp:34:0, 
      from MAIN.cpp:3: 
../HMMlib/sse_operator_traits.hpp:63:35: error: ‘__m128’ was not declared in this scope 
../HMMlib/sse_operator_traits.hpp:63:41: error: template argument 2 is invalid 
../HMMlib/sse_operator_traits.hpp:95:36: error: ‘__m128d’ was not declared in this scope 
../HMMlib/sse_operator_traits.hpp:95:43: error: template argument 2 is invalid 

我絕對不知道這些錯誤的意思,以及如何解決這些問題

+1

加上'-march = native'編譯爲自己的CPU,或者選擇從'人gcc'適當'-march'選項(它應該是支持SSE3的CPU)。 – 2013-02-15 11:42:05

回答

7

您必須啓用GCC的SSE3內在有一個命令行選項。試着用

g++ -msse3 -I/usr/local/boost_1_52_0 -I../ MAIN.cpp 

編譯或選擇指令由處理器

g++ -march=core2 -I/usr/local/boost_1_52_0 -I../ MAIN.cpp 

回覆設爲您的評論:-march=native選擇您當前正在運行的處理器的指令集。

注意-msse3已經選擇其子集-msse2-msse

+0

它返回說「g ++:錯誤:無法識別的選項'-sse3'」 – 2013-02-15 11:42:02

+0

但-march =本地工作,但這是做什麼? – 2013-02-15 11:43:14

+0

@AdityaSihag:這是我的錯誤,我糾正了 – jpalecek 2013-02-15 11:43:22