<?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 Greetings,  in OpenCL* for CPU</title>
    <link>https://community.intel.com/t5/OpenCL-for-CPU/Problem-with-MACROS-added-with-clBuildProgram/m-p/1048890#M3995</link>
    <description>&lt;P&gt;Greetings,&amp;nbsp;&lt;/P&gt;

&lt;P&gt;I have the same problem , however, the value of the passed option is only known at runtime, (i.e. the 1024 in the above example is unknown&amp;nbsp;at compile time) , how can I handle this ? &amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 09 Oct 2016 19:19:49 GMT</pubDate>
    <dc:creator>Omar_I_</dc:creator>
    <dc:date>2016-10-09T19:19:49Z</dc:date>
    <item>
      <title>Problem with MACROS added with clBuildProgram</title>
      <link>https://community.intel.com/t5/OpenCL-for-CPU/Problem-with-MACROS-added-with-clBuildProgram/m-p/1048887#M3992</link>
      <description>&lt;P&gt;Hi to everyone,&lt;/P&gt;

&lt;P&gt;I have a problem with the SDK plugin for Visual Studio 2010. In my kernel I add several MACROS using the -D flag inside the options argument of the clBuildProgram function. However, this is not recognized by the Intel OpenCL SDK plugin, therefore it throws several "use of undeclared identifier" errors and I am not able to run my program.&lt;/P&gt;

&lt;P&gt;I am able to run the Kernel if I disable the plugin, but it would be nice to be able to use it, so is there a way to fix this, or I should explicitly declare this macros inside my kernel to be able to debug it using the VS plugin?&lt;/P&gt;

&lt;P&gt;Thanks for your help!&lt;/P&gt;

&lt;P&gt;PS: As a small example, I have defined in my .cl file the following struct:&lt;BR /&gt;
	&lt;BR /&gt;
	&amp;nbsp;&lt;/P&gt;

&lt;PRE class="brush:cpp;"&gt;typedef struct{
	double zbound[MXREG];
	int nzb;
} Geom;&lt;/PRE&gt;

&lt;P&gt;Therefore, I define MXREG using the -D flag when calling clBuildProgram:&lt;BR /&gt;
	&lt;BR /&gt;
	&amp;nbsp;&lt;/P&gt;

&lt;PRE class="brush:cpp;"&gt;char options[64];
sprintf(options, "-DMXREG=%d, geom.nzb);
cl_program program;
program = oclBuildProgram(device, context, PROGRAM_FILE, options);&lt;/PRE&gt;

&lt;P&gt;This works perfectly when the OpenCL plugin is not used.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Jan 2015 03:58:51 GMT</pubDate>
      <guid>https://community.intel.com/t5/OpenCL-for-CPU/Problem-with-MACROS-added-with-clBuildProgram/m-p/1048887#M3992</guid>
      <dc:creator>Edgardo_Doerner</dc:creator>
      <dc:date>2015-01-13T03:58:51Z</dc:date>
    </item>
    <item>
      <title>Edgardo,</title>
      <link>https://community.intel.com/t5/OpenCL-for-CPU/Problem-with-MACROS-added-with-clBuildProgram/m-p/1048888#M3993</link>
      <description>&lt;P&gt;Edgardo,&lt;/P&gt;

&lt;P&gt;Have you added these options to OpenCL Options line on the Build Options tab?&lt;span class="lia-inline-image-display-wrapper" image-alt="BuildOptions.png"&gt;&lt;img src="https://community.intel.com/t5/image/serverpage/image-id/7232i25BAFCD36FD6CD08/image-size/large?v=v2&amp;amp;px=999&amp;amp;whitelist-exif-data=Orientation%2CResolution%2COriginalDefaultFinalSize%2CCopyright" role="button" title="BuildOptions.png" alt="BuildOptions.png" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;I am using the latest version of the INDE tools (&lt;A href="https://software.intel.com/en-us/intel-inde"&gt;https://software.intel.com/en-us/intel-inde&lt;/A&gt;&amp;nbsp;)&amp;nbsp;and this option works for me (try to upgrade to the latest version of INDE and see if you still have an issue):&lt;/P&gt;

&lt;P&gt;&lt;FONT color="#1e1e1e" face="Consolas" size="1"&gt;&lt;FONT color="#1e1e1e" face="Consolas" size="1"&gt;&lt;FONT color="#1e1e1e" face="Consolas" size="1"&gt;Using build options: -DMXREG=1024&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;

&lt;P&gt;&lt;FONT color="#1e1e1e" face="Consolas" size="1"&gt;&lt;FONT color="#1e1e1e" face="Consolas" size="1"&gt;&lt;FONT color="#1e1e1e" face="Consolas" size="1"&gt;OpenCL Intel(R) Graphics device was found!&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;

&lt;P&gt;&lt;FONT color="#1e1e1e" face="Consolas" size="1"&gt;&lt;FONT color="#1e1e1e" face="Consolas" size="1"&gt;&lt;FONT color="#1e1e1e" face="Consolas" size="1"&gt;Device name: Intel(R) Iris(TM) Pro Graphics 5200&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;

&lt;P&gt;&lt;FONT color="#1e1e1e" face="Consolas" size="1"&gt;&lt;FONT color="#1e1e1e" face="Consolas" size="1"&gt;&lt;FONT color="#1e1e1e" face="Consolas" size="1"&gt;Device version: OpenCL 1.2 &lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;

&lt;P&gt;&lt;FONT color="#1e1e1e" face="Consolas" size="1"&gt;&lt;FONT color="#1e1e1e" face="Consolas" size="1"&gt;&lt;FONT color="#1e1e1e" face="Consolas" size="1"&gt;Device vendor: Intel(R) Corporation&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;

&lt;P&gt;&lt;FONT color="#1e1e1e" face="Consolas" size="1"&gt;&lt;FONT color="#1e1e1e" face="Consolas" size="1"&gt;&lt;FONT color="#1e1e1e" face="Consolas" size="1"&gt;Device profile: FULL_PROFILE&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;

&lt;P&gt;&lt;FONT color="#1e1e1e" face="Consolas" size="1"&gt;&lt;FONT color="#1e1e1e" face="Consolas" size="1"&gt;&lt;FONT color="#1e1e1e" face="Consolas" size="1"&gt;fcl build 1 succeeded.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;

&lt;P&gt;&lt;FONT color="#1e1e1e" face="Consolas" size="1"&gt;&lt;FONT color="#1e1e1e" face="Consolas" size="1"&gt;&lt;FONT color="#1e1e1e" face="Consolas" size="1"&gt;fcl build 2 succeeded.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;

&lt;P&gt;&lt;FONT color="#1e1e1e" face="Consolas" size="1"&gt;&lt;FONT color="#1e1e1e" face="Consolas" size="1"&gt;&lt;FONT color="#1e1e1e" face="Consolas" size="1"&gt;bcl build succeeded.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;

&lt;P&gt;&lt;FONT color="#1e1e1e" face="Consolas" size="1"&gt;&lt;FONT color="#1e1e1e" face="Consolas" size="1"&gt;&lt;FONT color="#1e1e1e" face="Consolas" size="1"&gt;Build succeeded!&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Jan 2015 18:57:36 GMT</pubDate>
      <guid>https://community.intel.com/t5/OpenCL-for-CPU/Problem-with-MACROS-added-with-clBuildProgram/m-p/1048888#M3993</guid>
      <dc:creator>Robert_I_Intel</dc:creator>
      <dc:date>2015-01-26T18:57:36Z</dc:date>
    </item>
    <item>
      <title>Hi Robert, your suggestion</title>
      <link>https://community.intel.com/t5/OpenCL-for-CPU/Problem-with-MACROS-added-with-clBuildProgram/m-p/1048889#M3994</link>
      <description>&lt;P&gt;Hi Robert, your suggestion worked!... thanks for your help!&lt;/P&gt;</description>
      <pubDate>Wed, 28 Jan 2015 03:31:03 GMT</pubDate>
      <guid>https://community.intel.com/t5/OpenCL-for-CPU/Problem-with-MACROS-added-with-clBuildProgram/m-p/1048889#M3994</guid>
      <dc:creator>Edgardo_Doerner</dc:creator>
      <dc:date>2015-01-28T03:31:03Z</dc:date>
    </item>
    <item>
      <title>Greetings, </title>
      <link>https://community.intel.com/t5/OpenCL-for-CPU/Problem-with-MACROS-added-with-clBuildProgram/m-p/1048890#M3995</link>
      <description>&lt;P&gt;Greetings,&amp;nbsp;&lt;/P&gt;

&lt;P&gt;I have the same problem , however, the value of the passed option is only known at runtime, (i.e. the 1024 in the above example is unknown&amp;nbsp;at compile time) , how can I handle this ? &amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 09 Oct 2016 19:19:49 GMT</pubDate>
      <guid>https://community.intel.com/t5/OpenCL-for-CPU/Problem-with-MACROS-added-with-clBuildProgram/m-p/1048890#M3995</guid>
      <dc:creator>Omar_I_</dc:creator>
      <dc:date>2016-10-09T19:19:49Z</dc:date>
    </item>
    <item>
      <title>If you need the application</title>
      <link>https://community.intel.com/t5/OpenCL-for-CPU/Problem-with-MACROS-added-with-clBuildProgram/m-p/1048891#M3996</link>
      <description>&lt;P&gt;If you need the application to update the value then you'll need a combination of the two:&lt;/P&gt;

&lt;P&gt;1) Set -DMXREG in the Code Builder properties. &amp;nbsp;This is to help with the Code Builder compilation so you won't see errors for missing symbols at compile time.&lt;/P&gt;

&lt;P&gt;2) Set the runtime value in the build options.&lt;/P&gt;

&lt;PRE class="brush:cpp;"&gt;char options[64];
sprintf(options, "-g -s \"./source.cl\" -DMXREG=%d, geom.nzb);
cl_program program;
program = oclBuildProgram(device, context, PROGRAM_FILE, options);&lt;/PRE&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;In my tests the value in #1 was overwritten when the code was recompiled at runtime. &amp;nbsp;When a breakpoint was applied in in the kernel I coudl see the value from step2.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Oct 2016 05:45:41 GMT</pubDate>
      <guid>https://community.intel.com/t5/OpenCL-for-CPU/Problem-with-MACROS-added-with-clBuildProgram/m-p/1048891#M3996</guid>
      <dc:creator>Jeffrey_M_Intel1</dc:creator>
      <dc:date>2016-10-10T05:45:41Z</dc:date>
    </item>
  </channel>
</rss>

