<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Hi David,  in Software Archive</title>
    <link>https://community.intel.com/t5/Software-Archive/Building-an-OpenCL-example/m-p/941420#M17102</link>
    <description>&lt;P&gt;Hi David,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To &amp;nbsp;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&amp;nbsp;-L/opt/intel/opencl-1.2-3.0.56860/libmic to make use of there libraries.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 24 Apr 2013 14:34:18 GMT</pubDate>
    <dc:creator>Sumedh_N_Intel</dc:creator>
    <dc:date>2013-04-24T14:34:18Z</dc:date>
    <item>
      <title>Building an OpenCL example</title>
      <link>https://community.intel.com/t5/Software-Archive/Building-an-OpenCL-example/m-p/941418#M17100</link>
      <description>&lt;P&gt;I have a simple OpenCL test application that woeks on a CPU and GPU, but won't build on the MIC.&lt;/P&gt;
&lt;P&gt;I've tried the build option:&lt;/P&gt;
&lt;P&gt;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&lt;/P&gt;
&lt;P&gt;and get the error message is : "cl.hpp(1943): error: identifier "alloca" is undefined"&lt;/P&gt;
&lt;P&gt;When I modified the build options to:&lt;/P&gt;
&lt;P&gt;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&lt;/P&gt;
&lt;P&gt;I get the following error message:&lt;BR /&gt;x86_64-k1om-linux-ld: skipping incompatible /opt/intel/opencl-1.2-3.0.56860/lib64/libOpenCL.so when searching for -lOpenCL&lt;BR /&gt;x86_64-k1om-linux-ld: cannot find -lOpenCL&lt;/P&gt;
&lt;P&gt;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&lt;/P&gt;
&lt;P&gt;Below is the makefile.&lt;/P&gt;
&lt;P&gt;CC=icpc&lt;BR /&gt;&lt;BR /&gt;CCFLAGS=-mmic -O3 -std=c++11 -I/opt/intel/opencl-1.2-3.0.56860/include&lt;BR /&gt;&lt;BR /&gt;LIBS = -L/opt/intel/opencl-1.2-3.0.56860/lib64 -lOpenCL -lrt&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;vector_add: vector_add.cpp&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $(CC) $^ $(CCFLAGS) $(LIBS) -o $@&lt;/P&gt;</description>
      <pubDate>Wed, 24 Apr 2013 08:12:03 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Building-an-OpenCL-example/m-p/941418#M17100</guid>
      <dc:creator>David_B_16</dc:creator>
      <dc:date>2013-04-24T08:12:03Z</dc:date>
    </item>
    <item>
      <title>hello David,</title>
      <link>https://community.intel.com/t5/Software-Archive/Building-an-OpenCL-example/m-p/941419#M17101</link>
      <description>&lt;P&gt;hello David,&lt;/P&gt;
&lt;P&gt;If i understand correct ...lib64 points to regular linux host&amp;nbsp;intel64 &amp;nbsp;libraries&amp;nbsp;you need to add path to OpenCL MIC libraries to the -L option.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;--Vladimir&lt;/P&gt;</description>
      <pubDate>Wed, 24 Apr 2013 08:42:23 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Building-an-OpenCL-example/m-p/941419#M17101</guid>
      <dc:creator>Vladimir_P_1234567890</dc:creator>
      <dc:date>2013-04-24T08:42:23Z</dc:date>
    </item>
    <item>
      <title>Hi David, </title>
      <link>https://community.intel.com/t5/Software-Archive/Building-an-OpenCL-example/m-p/941420#M17102</link>
      <description>&lt;P&gt;Hi David,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To &amp;nbsp;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&amp;nbsp;-L/opt/intel/opencl-1.2-3.0.56860/libmic to make use of there libraries.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Apr 2013 14:34:18 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Building-an-OpenCL-example/m-p/941420#M17102</guid>
      <dc:creator>Sumedh_N_Intel</dc:creator>
      <dc:date>2013-04-24T14:34:18Z</dc:date>
    </item>
    <item>
      <title>Vladimir,</title>
      <link>https://community.intel.com/t5/Software-Archive/Building-an-OpenCL-example/m-p/941421#M17103</link>
      <description>&lt;P&gt;Vladimir,&lt;/P&gt;
&lt;P&gt;I am still getting the same error using the MIC icpc compiler and linking libraries. Even after installing all the latest rpm's.&lt;/P&gt;
&lt;P&gt;/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&amp;nbsp; -lOpenCL -lrt -o vector_add&lt;BR /&gt;x86_64-k1om-linux-ld: skipping incompatible /opt/intel/opencl-1.2-3.0.56860/lib64/libOpenCL.so when searching for -lOpenCL&lt;BR /&gt;x86_64-k1om-linux-ld: cannot find -lOpenCL&lt;/P&gt;
&lt;P&gt;When I try with the standatd IntelX86 icpc compiler I get an undefined alloca in the Intel cl.hpp file.&lt;/P&gt;
&lt;P&gt;/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&amp;nbsp; -lOpenCL -lrt -o vector_add&lt;BR /&gt;/opt/intel/opencl-1.2-3.0.56860/include/CL/cl.hpp(1945): error: identifier "alloca" is undefined&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cl_device_id* ids = (cl_device_id*) alloca(n * sizeof(cl_device_id));&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;David&lt;/P&gt;</description>
      <pubDate>Wed, 24 Apr 2013 14:37:21 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Building-an-OpenCL-example/m-p/941421#M17103</guid>
      <dc:creator>David_B_16</dc:creator>
      <dc:date>2013-04-24T14:37:21Z</dc:date>
    </item>
    <item>
      <title>Hi David,</title>
      <link>https://community.intel.com/t5/Software-Archive/Building-an-OpenCL-example/m-p/941422#M17104</link>
      <description>Hi David,

You should not use MIC icpc compiler (or use -mmic option) to build an OpenCL application. When you use it you build an application that runs natively on MIC, but OpenCL application should run on host system (it will then send calculations to a device according to your program).

So, the 1st command in your original post looks OK to me. The questions is why do you get "undefined alloca" error.
What OS are you using? I guees, the header file "alloca.h" should be in /usr/include (at least on the systems that we officially support - RHEL and SLES). And it's included in cl.hpp using #ifdef:
#if defined(linux) || defined(__APPLE__) || defined(__MACOSX)

You can also try to add -H compiler option to get a list of include files to see if it has been included.

BTW, please post OpenCL related questions to dedicated forum - &lt;A href="http://software.intel.com/en-us/forums/intel-opencl-sdk/" target="_blank"&gt;http://software.intel.com/en-us/forums/intel-opencl-sdk/&lt;/A&gt;

Thanks,
Yuri</description>
      <pubDate>Thu, 25 Apr 2013 10:05:15 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Building-an-OpenCL-example/m-p/941422#M17104</guid>
      <dc:creator>Yuri_K_Intel</dc:creator>
      <dc:date>2013-04-25T10:05:15Z</dc:date>
    </item>
    <item>
      <title>Yuri,</title>
      <link>https://community.intel.com/t5/Software-Archive/Building-an-OpenCL-example/m-p/941423#M17105</link>
      <description>&lt;P&gt;Yuri,&lt;/P&gt;
&lt;P&gt;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.&lt;/P&gt;</description>
      <pubDate>Thu, 25 Apr 2013 13:37:54 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Building-an-OpenCL-example/m-p/941423#M17105</guid>
      <dc:creator>David_B_16</dc:creator>
      <dc:date>2013-04-25T13:37:54Z</dc:date>
    </item>
  </channel>
</rss>

