Since the idbc_mic debugger still denies to work together with the Xeon Phi I did another experiment today and tried to get the Phi running with OpenCL. So I downloaded the latest version of the Intel OpenCL SDK 2013 and the drivers for processors and the one for Xeon Phi from: http://software.intel.com/en-us/vcsource/tools/opencl-sdk-xe. Like for the MPSS Intels software only supports RedHat and SuSe Enterprise. So I downloaded the three archives and unzipped them one by one with tar xvf. After that I executed in all of the three unzipped directories these both loops:
for f in *.rpm; sudo alien –scripts $f; done
for f in *.deb; sudo dpkg -i $f, done
to convert and install the packages for the two drivers and the general software. Within that process I didn’t get any errors and everything seems to be installed.
Since all linked linux sample projects from: http://software.intel.com/en-us/articles/intel-sdk-for-opencl-applications-xe-samples-getting-started/ lead to dead links, I had to take the Windows samples package from: http://software.intel.com/en-us/articles/intel-sdk-for-opencl-applications-samples-getting-started/ and to modify the MedianFilter project, so that it runs under Linux. All code, except the OpenCL kernel, is placed in one cpp file. The Makefile looks like this:
INCLUDES=-I. -I../common -I/usr/include/ -I/opt/intel/opencl/include
SRCS = ocl.cpp
OBJS = ocl.o
$(CC) $(CFLAGS) -c $*.cpp
$(CC) $(CFLAGS) $(SRCS) -o $(PROGNAME) $(LIBS)
$(rm) $(OBJS) $(PROGNAME) core *~
But when trying to compile this, I get a warning that the numactl library wasn’t found on which the OpenCL libs are depended. A try to run the program anyway ended up in a crash because the needed *.so file couldn’t be found (no wonder :)). So I downloaded the numcatl package for Fedora 15 from: http://rpm.pbone.net/index.php3/stat/4/idpl/16839339/dir/fedora_15/com/numactl-2.0.7-1.fc15.x86_64.rpm.html, converted it to *.deb with the help of alien and installed it with dpgk. After that I found the Ubuntu solution from: http://packages.ubuntu.com/de/hardy/numactl. But it isn’t installed yet.
After that my program compiled and could be run. But the functions to find the OpenCL devices in the system only are aware of the Xeon E5 processors on the board and not on the Xeon Phi, although its driver is installed. I’m still searching a solution for this.
My problem was not to install OpenCL but to initialize it correctly. So everything I explained here was correct and the installation was complete. First I used an example code from the Internet, to make sure, that the Phi is really registered as OpenCL device . This created me the following output:
platform count: 1
device count: 2
1. Device: Intel(R) Xeon(R) CPU E5-2670 0 @ 2.60GHz
1.1 Hardware version: OpenCL 1.2 (Build 56860)
1.2 Software version: 1.2
1.3 OpenCL C version: OpenCL C 1.2
1.4 Parallel compute units: 32
2. Device: Intel(R) Many Integrated Core Acceleration Card
2.1 Hardware version: OpenCL 1.2
2.2 Software version: 1.2
2.3 OpenCL C version: OpenCL C 1.2 (Build 56860)
2.4 Parallel compute units: 236
At this point I could be sure, that the Phi is ready to work, but the next question was how to use it. After a while of reading the OpenCL Documentation I got a hint to the device type CL_DEVICE_TYPE_ACCELERATOR and with that I was able to calculate on Phi. The following code shows how I initialize my device (declarations and error handling ommited).
context = clCreateContextFromType(cprops,
status = clGetContextInfo(context,
devices = (cl_device_id *)malloc(deviceListSize);
commandQueue = clCreateCommandQueue(
Now with device I can do the rest of the initialization work.