Search code examples
linuxopenclxeon-phi

OpenCL library link fail with Xeon Phi when compile


I want to run OpenCL on Xeon Phi coprocessor,
So I try to install Intel OpenCL SDK on my server,
Now, I can run OpenCL on host correctly, but I try to compile the code to MIC use, like this:

icpc capsbasic.cpp -mmic -lOpenCL -ocapsbasic
x86_64-k1om-linux-ld: skipping incompatible /opt/intel/opencl/lib64/libOpenCL.so                           
when searching for -lOpenCL
x86_64-k1om-linux-ld: cannot find -lOpenCL
make: *** [capsbasic] Error 1

the "libOpenCL.so" is exist, and it can run well without tag"-mmic",
I feel so bad and anything can I do to fix it?


Solution

  • The -mmic flag is used to build a native binary that runs entirely on the coprocessor. If you are using OpenCL, this is not what you want to do. The OpenCL approach is to run your code on the host CPU, and offload compute intensive portions of your code to the device using the OpenCL runtime API. Your Xeon Phi should show up as an OpenCL device when the application is running on the host CPU; if it doesn't, then your device is not configured correctly. Make sure you have installed the Intel MPSS driver as well as the correct OpenCL SDK.