Software Archive
Read-only legacy content

Running OpenCV Computer Vision Programs on Xeon Phi

Tejeswini_S_
Beginner
1,048 Views
 
Hello,
I would like to know how to run opencv programs by using the intel xeon phi coprocessor card? What are my options? Also, how can i work with the Transparent API released by OpenCV and Xeon Phi ? Has Intel developed any module or support for running computer visions programs on the xeon phi?  Any suggestions or thoughts in this regard will be greatly appreciated.
Thankyou.
0 Kudos
4 Replies
Frances_R_Intel
Employee
1,048 Views

I have never done this myself but this is what I have been told -

You should be able to compile OpenCV and use it on the coprocessor but to do this, you will need to build it with Cmake using the Intel compilers and specifying the MIC compiler options.

To use Transparent API, you will need OpenCL. See Intel® Code Builder for OpenCL™ API for information on getting and installing OpenCL Code Builder.

And the recommendation I have received is - build it first for the host machine and play around with it, so that you know the basics of the build and install are ok; then build for the coprocessor.

0 Kudos
Tejeswini_S_
Beginner
1,048 Views

Hello Frances,

Thankyou for your reply. So,i understand that you suggest to use the intel icc compiler instead of gcc to build my OpenCV code using Cmake.  However, Is it possible/advisable for me to use cross-compilation using gcc complier ? https://software.intel.com/en-us/articles/cross-compilation-for-intel-xeon-phi-coprocessor-with-cmake. Thankyou for the OpeCL API Link. I will go through it. Also, i would like to know how i could compile my OpenCV code using OpenCL natively on Xeon Phi?

0 Kudos
Frances_R_Intel
Employee
1,048 Views

The thing about the gcc compiler - it does not vectorize the code it produces for the coprocessor. Since, in this case, performance counts, you will want to use icc, the Intel compiler, as shown in the article you referenced. I would suggest setting your environment as shown in that article, plus any OpenCV cmake environment variables you need.

I think the answer to the question - how do I compile OpenCV natively on the coprocessor using OpenCL - is you don't. I don't believe that is supported at present.

One other thing - to build a static library for use on the coprocessor, you need to use xiar rather than ar, so that is one more thing you may need to change when you build OpenCV and OpenCL.

0 Kudos
Tejeswini_S_
Beginner
1,048 Views

Alright, so I am setting up my environment as suggested along with the icc compiler and the environment suggested by the article. Thankyou for clarifying that i cannot use native compilation on the xeon phi for my problem statement, yet. Also, when folks from Intel commented that OpenCV is working on the Xeon Phi internally, does it mean they used the Offload execution mode to do so ?

0 Kudos
Reply