Working with Intel® Code Builder for OpenCL™ API on Systems Equipped with Intel® Xeon Phi™ x100 Coprocessor

By Loc Q Nguyen,

Published:04/28/2015   Last Updated:04/28/2015

Due to the recent restructuring in OpenCL™ Technology, the Intel® Code Builder for OpenCL™ replaces the Intel® SDK for OpenCL™ Applications. For the Intel® Xeon Phi™ x100 coprocessor, that means we need a specific OpenCL™ Runtime and the Code Builder for the coprocessor. So I decided to install the new OpenCL development environment and test an application on the Intel® Xeon Phi™ x100 coprocessor (codename Knights Corner). I’d like to share this experience with you in case you want to build and run an OpenCL application on your system equipped with Intel® Xeon Phi™ x100 cards.

My host system runs RHEL 64-bit 6.5 (kernel 2.6.32-431). It has two Intel® Xeon Phi™ coprocessors, and has Intel® C++ Composer XE 2015.0.2 (composer XE 2005.2.164) installed.

According to the OpenCL™ Runtime release notes (see /content/www/us/en/develop/articles/opencl-runtime-release-notes.html ), in order to work with the coprocessor I need to install the MPSS 3.3 (not MPSS 3.4 and later).

First I installed the latest MPSS 3.3 version followed by the OpenCL runtime 14.2 (CPU + Xeon Phi) and then the Code Builder:

  1. Download the MPSS 3.3.4 from /content/www/us/en/develop/articles/intel-manycore-platform-software-stack-mpss-archive.html . Install it according to the provided readme file. Finally bring the MPSS service up:

    # service mpss start

  2. Download the OpenCL™ Runtime 14.2 (for Intel® CPU and Intel® Xeon Phi™ coprocessors for Linux* 64-bit) available at /content/www/us/en/develop/articles/opencl-drivers.html . The OpenCL™ Runtime allows me to run an OpenCL™ application.

    # tar zxvf opencl_runtime_14.2_x64_4.5.0.8.tgz

    This creates a sub-directory called pset_opencl_runtime_14.1_x64_4.5.0.8

    # cd pset_opencl_runtime_14.1_x64_4.5.0.8
    # ./install.sh

  3. Download the Intel® Code Builder for OpenCL™ API 2014 R3 for Linux*(with support for Intel® Xeon Phi™ coprocessors available at /content/www/us/en/develop/articles/intel-code-builder-for-opencl-api.html . The Code Builder allows me to build OpenCL binaries.

    # tar zxvf intel_code_builder_for_opencl_2014_4.6.0.178_x64.tgz

    This creates a subdirectory called intel_code_builder_for_opencl_2014_4.6.0.178_x64

    # cd intel_code_builder_for_opencl_2014_4.6.0.178_x64
    # ./install.sh

For testing purposes, I downloaded OpenCL source code from the article /content/www/us/en/develop/articles/using-the-intel-sdk-for-opencl-applications-xe-2013.html . The sample package is named opencl-sample.zip. I unzipped it in Windows* and transferred all the files to my Linux system. They included ocl_sample.cpp, kernel ocl_sample.cl and the input image called input.pgm.

# source <installed directory>/bin/compilervar.sh intel64
# icc ocl_sample.cpp –lOpenCL –o ocl_sample.out

#./ocl_sample.out

Platform: Intel(R) OpenCL
Number of accelerators found: 2

DEVICE #0:
NAME:Intel(R) Many Integrated Core Acceleration Card
#COMPUTE UNITS:240

DEVICE #1:
NAME:Intel(R) Many Integrated Core Acceleration Card
#COMPUTE UNITS:240
OpenCL Initialization Completed
Completed reading Input Image: 'input.pgm'
Transferring Data from Host to Device
Executing Kernel on selected devices
Transferring data from Device to Host
Completed writing Output Image: 'output.pgm'
Completed execution! Cleaning Up.

This generates an output image called output.pgm. The image is the result of applying a Gaussian blur to the input image.

 

For completeness, I retested the above application with all MPSS 3.3 versions, namely MPSS 3.3.1, MPSS 3.3.2, and 3.3.3. With the above OpenCL™ Runtime and Code Builder for OpenCL™ API, I was able to run the test successfully with MPSS 3.3.4, MPSS 3.3.3, MPSS 3.3.2 and MPSS 3.3.1. Note that whenever you uninstall / install another version of MPSS 3.3, before rerunning the application you need to repair the OpenCL™ Runtime or simply just uninstall and re-install it again. To repair the OpenCL™ Runtime, go to the OpenCL™ Runtime installation directory, type ./install.sh and choose #2-Repair the installation.

 

Product and Performance Information

1

Performance varies by use, configuration and other factors. Learn more at www.Intel.com/PerformanceIndex.