- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have a simple OpenCL test application that woeks on a CPU and GPU, but won't build on the MIC.
I've tried the build option:
icpc vector_add.cpp -O3 -std=c++11 -I/opt/intel/opencl-1.2-3.0.56860/include -L/opt/intel/opencl-1.2-3.0.56860/lib64 -lOpenCL -lrt -o vector_add
and get the error message is : "cl.hpp(1943): error: identifier "alloca" is undefined"
When I modified the build options to:
icpc vector_add.cpp -mmic -O3 -std=c++11 -I/opt/intel/opencl-1.2-3.0.56860/include -L/opt/intel/opencl-1.2-3.0.56860/lib64 -lOpenCL -lrt -o vector_add
I get the following error message:
x86_64-k1om-linux-ld: skipping incompatible /opt/intel/opencl-1.2-3.0.56860/lib64/libOpenCL.so when searching for -lOpenCL
x86_64-k1om-linux-ld: cannot find -lOpenCL
I am using the 13.1 compiler and assumed it it was making a 64bit version, which should be compatible with the with intel 64bit libOpenCL.so
Below is the makefile.
CC=icpc
CCFLAGS=-mmic -O3 -std=c++11 -I/opt/intel/opencl-1.2-3.0.56860/include
LIBS = -L/opt/intel/opencl-1.2-3.0.56860/lib64 -lOpenCL -lrt
vector_add: vector_add.cpp
$(CC) $^ $(CCFLAGS) $(LIBS) -o $@
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
hello David,
If i understand correct ...lib64 points to regular linux host intel64 libraries you need to add path to OpenCL MIC libraries to the -L option.
--Vladimir
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi David,
To clarify on what Vladimir said: If you look within the OpenCL installation folder, you will find two sets of libraries lib64 and libmic. lib64 are host libraries where as libmic are libraries for the Intel Xeon Phi coprocessor. So, to run the application on the coprocoessor you would need to change your library path to -L/opt/intel/opencl-1.2-3.0.56860/libmic to make use of there libraries.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Vladimir,
I am still getting the same error using the MIC icpc compiler and linking libraries. Even after installing all the latest rpm's.
/opt/intel/composer_xe_2013.0.079/bin/intel64_mic/icpc vector_add.cpp -O3 -std=c++11 -I/opt/intel/opencl-1.2-3.0.56860/include -L/opt/intel/opencl-1.2-3.0.56860/libmic -L/opt/intel/composer_xe_2013.0.079/compiler/lib/mic/ -L/opt/intel/opencl-1.2-3.0.56860/lib64 -lOpenCL -lrt -o vector_add
x86_64-k1om-linux-ld: skipping incompatible /opt/intel/opencl-1.2-3.0.56860/lib64/libOpenCL.so when searching for -lOpenCL
x86_64-k1om-linux-ld: cannot find -lOpenCL
When I try with the standatd IntelX86 icpc compiler I get an undefined alloca in the Intel cl.hpp file.
/opt/intel/composer_xe_2013.0.079/bin/intel64/icpc vector_add.cpp -O3 -std=c++11 -I/opt/intel/opencl-1.2-3.0.56860/include -L/opt/intel/opencl-1.2-3.0.56860/libmic -L/opt/intel/composer_xe_2013.0.079/compiler/lib/mic/ -L/opt/intel/opencl-1.2-3.0.56860/lib64 -lOpenCL -lrt -o vector_add
/opt/intel/opencl-1.2-3.0.56860/include/CL/cl.hpp(1945): error: identifier "alloca" is undefined
cl_device_id* ids = (cl_device_id*) alloca(n * sizeof(cl_device_id));
David
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yuri,
The problem was I need to use C++11 but forgot to add the compile option -Dlinux which meant that the #if defined(linux) || defined(__APPLE__) || defined(__MACOSX) preprocessor returned false and alloca.h wasn't being included.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page