Dlib支持CPU指令集编译问题(SSE4.2或者AVX)

The compile script is:

mkdir build
cd build
cmake ../../tools/python -DUSE_SSE2_INSTRUCTIONS=ON
cmake --build . --config Release --target install 
cd ..

You forgot the -D. So you have to say, cmake -DUSE_SSE2_INSTRUCTIONS=ON(-DUSE_SSE2_INSTRUCTIONS=0)

cmake ../../tools/python -DUSE_SSE4_INSTRUCTIONS=OFF
cmake ../../tools/python -DUSE_SSE2_INSTRUCTIONS=ON
python setup.py install --yes USE_AVX_INSTRUCTIONS --yes USE_SSE2_INSTRUCTIONS --yes USE_SSE4_INSTRUCTIONS
只安装基于SSE2指令集的Dlib包:
python3.6 setup.py build --no USE_AVX_INSTRUCTIONS --yes USE_SSE2_INSTRUCTIONS --no USE_SSE4_INSTRUCTIONS
CMake编译用: -DUSE_SSE4_INSTRUCTIONS=OFF
python setup.py build 编译用: --no USE_SSE4_INSTRUCTIONS

for Python 3 support use:

python setup.py install --yes DPYTHON3

I just ran into this and it was because the python module was being compiled with SSE4 instructions but my CPU only supports SSE2. Open tools/python/CMakeLists.txt and edit the line:

set(USE_SSE4_INSTRUCTIONS ON CACHE BOOL "Use SSE4 instructions")
In my case I changed it to:
set(USE_SSE2_INSTRUCTIONS ON CACHE BOOL "Use SSE2 instructions")


版本1(默认版本):

git clone https://github.com/davisking/dlib.git    //Clone the code from github
cd dlib
mkdir build
cd build
cmake .. -DDLIB_USE_CUDA=0 -DUSE_AVX_INSTRUCTIONS=1 //以AVX指令的方式编译dlib
cmake --build .
cd ..
sudo python setup.py install --yes USE_AVX_INSTRUCTIONS --no DLIB_USE_CUDA

注:最后一步需要等待一些时间。如果使用python3.x版本,最后一步命令python改为python3

版本2(版本1不成功,请试下版本2):

git clone https://github.com/davisking/dlib.git //Clone the code from github
cd dlib
mkdir build
cd build
cmake ..                        //以默认方式(SSE41指令)编译dlib
cmake --build .
cd ..
sudo python setup.py install

注:最后一步需要等待一些时间。如果使用python3.x版本,最后一步命令python改为python3

猜你喜欢

转载自www.cnblogs.com/laosan007/p/11738200.html