Ask Your Question
0

OpenCV Fails to Install on Ubuntu 16.10 using ICC and ICPC

asked 2017-05-29 04:24:57 -0600

cepp gravatar image

Hi all,

I'll try to provide as much detail as possible off the bat. I'm using Ubuntu 16.10 with Intel ICC and ICPC installed and I want to compile OpenCV such that it can be run by Caffe. I am using the latest version of Cuda 8.0 with NVIDIA drivers.

About my hardware -- I have a system with 2 Xeons (Intel(R) Xeon(R) CPU E5-2630 v4 @ 2.20GHz), nproc will return 40, and 4x NVIDIA Tesla P100 (Tesla P100-PCIE-16GB). I have tried to specify the architecture of my cards below.

I've used the following CMake options: sudo CC=/opt/intel/bin/icc CXX=/opt/intel/bin/icpc cmake \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_INSTALL_PREFIX=/opt/opencv \ -DBUILD_PNG=OFF \ -DBUILD_TIFF=OFF \ -DBUILD_TBB=OFF \ -DBUILD_JPEG=OFF \ -DBUILD_JASPER=OFF \ -DBUILD_ZLIB=OFF \ -DBUILD_opencv_java=OFF \ -DBUILD_opencv_python2=OFF \ -DBUILD_opencv_python3=OFF \ -DWITH_OPENCL=OFF \ -DWITH_OPENMP=OFF \ -DWITH_FFMPEG=ON \ -DWITH_GSTREAMER=OFF \ -DWITH_GSTREAMER_0_10=OFF \ -DWITH_CUDA=ON \ -DWITH_GTK=ON \ -DWITH_VTK=OFF \ -DWITH_TBB=ON \ -DWITH_1394=OFF \ -DWITH_OPENEXR=OFF \ -DCUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda-8.0 \ -DWITH_V4L=ON \ -DWITH_QT=OFF \ -DINSTALL_TESTS=OFF \ -DENABLE_FAST_MATH=1 \ -DCUDA_FAST_MATH=1 \ -DCUDA_NVCC_FLAGS="-D_FORCE_INLINES" \ -DENABLE_PRECOMPILED_HEADERS=OFF \ -DWITH_IPP=OFF \ -DBUILD_LIBPROTOBUF_FROM_SOURCES=ON \ -DCUDA_ARCH_NAME="Manual" \ -DCUDA_ARCH_BIN="52 60" \ -DCUDA_ARCH_PTX="60" \ -DWITH_CUBLAS=ON \ -DWITH_CUDA=ON \ -DBUILD_PERF_TESTS=OFF \ -DBUILD_TESTS=OFF \ -DWITH_GTK=OFF \ -DWITH_OPENCL=OFF \ -DBUILD_opencv_java=OFF \ -DBUILD_opencv_python2=OFF \ -DBUILD_opencv_python3=OFF \ -DBUILD_EXAMPLES=OFF \ -D WITH_OPENCL=OFF \ -D WITH_OPENCL_SVM=OFF \ -D WITH_OPENCLAMDFFT=OFF \ -D WITH_OPENCLAMDBLAS=OFF \ ..

Additionally, I've attached the output of a verbose attempt at building OpenCV. After running the above cmake command I ran sudo make VERBOSE=1 &>log.txt to generate the output. In the logs, if you see <REDACTED> it's because I removed the name of the user/file in the path.

The output of the make can be found here: https://www.dropbox.com/s/8wfvgquj08k...

If I can provide any other information please let me know. Any and all help is greatly appreciated.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
2

answered 2017-05-30 10:18:34 -0600

mshabunin gravatar image

I can see following problems with your build:

  • you did not set compiler environment
  • you use sudo to build
  • setting compiler via CC and CXX environment do not always work correctly
  • you did not provide any versions: OpenCV? ICC?

And following concerns:

  • I don't think Caffe uses cv::cuda:: methods from OpenCV, so building OpenCV with CUDA support is not necessary
  • disabling IPP can affect performance of functions which are actually used by Caffe

I successfully built latest master version using the following script (ICC 2017.1.132):

. /opt/intel/compilers_and_libraries/linux/bin/compilervars.sh -arch intel64 -platform linux
pushd $BUILDDIR
cmake -GNinja \
    -DCMAKE_C_COMPILER=$(which icc) \
    -DCMAKE_CXX_COMPILER=$(which icc) \
    ../opencv
ninja
popd

Note: add -DCMAKE_INSTALL_PREFIX=/opt/opencv and run sudo ninja install after build to install the library to your paths

Note: using Ninja is optional, it works the same way as make -j <cpu-num> but faster

edit flag offensive delete link more

Comments

I've also successfully built Caffe with ICC and OpenCV (but without CUDA):

. /opt/intel/compilers_and_libraries/linux/bin/compilervars.sh -arch intel64 -platform linux
pushd $CAFFEBUILDDIR
cmake -GNinja \
    -DCMAKE_C_COMPILER=$(which icc) \
    -DCMAKE_CXX_COMPILER=$(which icc) \
    -DOpenCV_DIR=$BUILDDIR \
    -DCPU_ONLY=ON \
    ../caffe
ninja
popd
mshabunin gravatar imagemshabunin ( 2017-05-30 10:50:32 -0600 )edit

Question Tools

2 followers

Stats

Asked: 2017-05-29 04:24:57 -0600

Seen: 533 times

Last updated: May 30 '17