<?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 Sounds like a bug in our CPU in OpenCL* for CPU</title>
    <link>https://community.intel.com/t5/OpenCL-for-CPU/Different-printf-behavior-between-CPU-and-GPU/m-p/1034742#M3642</link>
    <description>&lt;P&gt;Sounds like a bug in our CPU implementation. I'll talk to our CPU folks. Workaround is of course to use something like this:&lt;/P&gt;

&lt;P&gt;#ifdef CPU&lt;/P&gt;

&lt;P&gt;printf("....\r\n",...);&lt;/P&gt;

&lt;P&gt;#else&lt;/P&gt;

&lt;P&gt;printf("...\n",...);&lt;/P&gt;

&lt;P&gt;#endif&lt;/P&gt;

&lt;P&gt;You can also just outright switch to \r\n.&lt;/P&gt;

&lt;P&gt;See&amp;nbsp;http://programmers.stackexchange.com/questions/29075/difference-between-n-and-r-n&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 07 Jan 2015 17:26:41 GMT</pubDate>
    <dc:creator>Robert_I_Intel</dc:creator>
    <dc:date>2015-01-07T17:26:41Z</dc:date>
    <item>
      <title>Different printf() behavior between CPU and GPU?</title>
      <link>https://community.intel.com/t5/OpenCL-for-CPU/Different-printf-behavior-between-CPU-and-GPU/m-p/1034741#M3641</link>
      <description>&lt;P&gt;&lt;SPAN style="font-size: 1em; line-height: 1.5;"&gt;I have a very simple kernel with printf statement like:&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 1em; line-height: 1.5;"&gt;printf("id: %d\n", id);&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;I am using the latest Intel SDK, on a 64-bit Windows system.&lt;/P&gt;

&lt;P&gt;When I run the kernel on the CPU, the "\n" results in a single 0x0A byte at the end of the printed string.&lt;/P&gt;

&lt;P&gt;When I run the kernel on GPU (Intel as well), the "\n" results in the two bytes 0x0A 0x0D.&lt;/P&gt;

&lt;P&gt;Is this the expected behavior? Is there any way to make both devices produce the same output?&lt;/P&gt;

&lt;P&gt;This is of course reminiscent of the differences between regular C/C++ on Linux and Windows, but here both devices are being used under Windows.&lt;/P&gt;

&lt;P&gt;Thanks in advance for any help or pointers - am I missing something obvious?&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 29 Dec 2014 03:15:04 GMT</pubDate>
      <guid>https://community.intel.com/t5/OpenCL-for-CPU/Different-printf-behavior-between-CPU-and-GPU/m-p/1034741#M3641</guid>
      <dc:creator>Adrian_H_</dc:creator>
      <dc:date>2014-12-29T03:15:04Z</dc:date>
    </item>
    <item>
      <title>Sounds like a bug in our CPU</title>
      <link>https://community.intel.com/t5/OpenCL-for-CPU/Different-printf-behavior-between-CPU-and-GPU/m-p/1034742#M3642</link>
      <description>&lt;P&gt;Sounds like a bug in our CPU implementation. I'll talk to our CPU folks. Workaround is of course to use something like this:&lt;/P&gt;

&lt;P&gt;#ifdef CPU&lt;/P&gt;

&lt;P&gt;printf("....\r\n",...);&lt;/P&gt;

&lt;P&gt;#else&lt;/P&gt;

&lt;P&gt;printf("...\n",...);&lt;/P&gt;

&lt;P&gt;#endif&lt;/P&gt;

&lt;P&gt;You can also just outright switch to \r\n.&lt;/P&gt;

&lt;P&gt;See&amp;nbsp;http://programmers.stackexchange.com/questions/29075/difference-between-n-and-r-n&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Jan 2015 17:26:41 GMT</pubDate>
      <guid>https://community.intel.com/t5/OpenCL-for-CPU/Different-printf-behavior-between-CPU-and-GPU/m-p/1034742#M3642</guid>
      <dc:creator>Robert_I_Intel</dc:creator>
      <dc:date>2015-01-07T17:26:41Z</dc:date>
    </item>
    <item>
      <title> </title>
      <link>https://community.intel.com/t5/OpenCL-for-CPU/Different-printf-behavior-between-CPU-and-GPU/m-p/1034743#M3643</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Robert,&lt;/P&gt;

&lt;P&gt;Thanks for the reply.&lt;/P&gt;

&lt;P&gt;I tried a quick test with AMD's SDK, on both CPU and GPU, and found that their implementation always translates to a single LF (0x0A) byte.&lt;/P&gt;

&lt;P&gt;So, in one sense the Intel GPU is the "odd man out", using 0x0D 0x0A. In summary:&lt;/P&gt;

&lt;P&gt;Intel SDK, CPU: "\n" gives 0x0A (LF)&lt;/P&gt;

&lt;P&gt;Intel SDK: GPU: "\n" gives 0x0D 0x0A (CR,LF)&lt;/P&gt;

&lt;P&gt;AMD SDK, CPU:&lt;SPAN style="line-height: 19.5120010375977px;"&gt;&amp;nbsp;"\n" gives 0x0A (LF)&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="line-height: 19.5120010375977px;"&gt;AMD SDK, GPU:&lt;/SPAN&gt;&lt;SPAN style="line-height: 19.5120010375977px;"&gt;&amp;nbsp;"\n" gives 0x0A (LF)&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;The OpenCL standard does not refer to control characters at all in its discussion of printf(), so all implementations are "correct".&lt;/P&gt;

&lt;P&gt;(The stackexchange link was interesting. I've been around since CP/M days, so it's all familiar!)&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Thanks again,&lt;/P&gt;

&lt;P&gt;Adrian&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Jan 2015 20:00:30 GMT</pubDate>
      <guid>https://community.intel.com/t5/OpenCL-for-CPU/Different-printf-behavior-between-CPU-and-GPU/m-p/1034743#M3643</guid>
      <dc:creator>Adrian_H_</dc:creator>
      <dc:date>2015-01-08T20:00:30Z</dc:date>
    </item>
  </channel>
</rss>

