<?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 (The forum killed my newline in OpenCL* for CPU</title>
    <link>https://community.intel.com/t5/OpenCL-for-CPU/printf-with-get-global-id-uses-wrong-placeholder/m-p/969153#M2353</link>
    <description>&lt;P&gt;(The forum killed my newline escape character - of course I mean %u[backslash]n instead of %un)&lt;/P&gt;
&lt;P&gt;Versions:&lt;BR /&gt;[bash]&lt;BR /&gt;[@memphis:~] $ cat /etc/SuSE-release &lt;BR /&gt;SUSE Linux Enterprise Server 11 (x86_64)&lt;BR /&gt;VERSION = 11&lt;BR /&gt;PATCHLEVEL = 2&lt;BR /&gt;[@memphis:~] $ uname -a&lt;BR /&gt;Linux memphis 3.0.13-0.27-default #1 SMP Wed Feb 15 13:33:49 UTC 2012 (d73692b) x86_64 x86_64 x86_64 GNU/Linux&lt;BR /&gt;[@memphis:~] 1 $ rpm -qa |grep intel&lt;BR /&gt;intel-mic-2.1.6720-15.suse&lt;BR /&gt;intel-mic-mpm-2.1.6720-15.suse&lt;BR /&gt;opencl-1.2-intel-mic-3.0.67279-1&lt;BR /&gt;intel-mic-sysmgmt-2.1.6720-15.suse&lt;BR /&gt;intel-mic-kmod-2.1.6720-15.3.0.13.0.suse&lt;BR /&gt;intel-mic-gdb-2.1.6720-15.suse&lt;BR /&gt;intel-mic-flash-2.1.386-3.suse&lt;BR /&gt;intel-mic-cdt-2.1.6720-15.suse&lt;BR /&gt;opencl-1.2-intel-devel-3.0.67279-1&lt;BR /&gt;intel-mic-micmgmt-2.1.6720-15.3.0.13.0.suse&lt;BR /&gt;opencl-1.2-intel-cpu-3.0.67279-1&lt;BR /&gt;intel-mic-gpl-2.1.6720-15.suse&lt;BR /&gt;intel-mic-crashmgr-2.1.6720-15.suse&lt;BR /&gt;[/bash]&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 05 Aug 2013 20:35:00 GMT</pubDate>
    <dc:creator>Markus_Dreseler</dc:creator>
    <dc:date>2013-08-05T20:35:00Z</dc:date>
    <item>
      <title>printf() with get_global_id uses wrong placeholder</title>
      <link>https://community.intel.com/t5/OpenCL-for-CPU/printf-with-get-global-id-uses-wrong-placeholder/m-p/969152#M2352</link>
      <description>&lt;P&gt;Hi everyone,&lt;/P&gt;
&lt;P&gt;I stumbled over a weird behavior that I cannot explain:&lt;/P&gt;
&lt;P&gt;[cpp]&lt;BR /&gt;size_t global_work_sizes[2] = {1, 1};&lt;BR /&gt;ret = clEnqueueNDRangeKernel(command_queue, kernel, 2, NULL, global_work_sizes, NULL, 0, NULL, NULL); CHECK(ret);&lt;BR /&gt;[/cpp]&lt;/P&gt;
&lt;P&gt;[cpp]&lt;BR /&gt;__kernel void foo() {&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;printf("global id %u\n", get_global_id(0));&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // returns global id 0&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;printf("global size %u\n", get_global_size(0));&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // returns global size 1&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;printf("global id: %u global size: %u\n", get_global_id(0), get_global_size(0));&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // returns global id: 0 global size: 0 - why is get_global_size(0) = 0?&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;printf("global id: %u global size: %u unused var: %u\n", get_global_id(0), get_global_size(0));&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // returns global id: 0 global size: 0 unused var: 1 - where does that 1 come from?&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;printf("%u %u\n", 0, 1);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // return 0 1 - that is what I would be expecting&lt;BR /&gt;}&lt;BR /&gt;[/cpp]&lt;/P&gt;
&lt;P&gt;Am I missing something here?&lt;/P&gt;
&lt;P&gt;Cheers,&lt;BR /&gt;Markus&lt;/P&gt;</description>
      <pubDate>Mon, 05 Aug 2013 20:33:51 GMT</pubDate>
      <guid>https://community.intel.com/t5/OpenCL-for-CPU/printf-with-get-global-id-uses-wrong-placeholder/m-p/969152#M2352</guid>
      <dc:creator>Markus_Dreseler</dc:creator>
      <dc:date>2013-08-05T20:33:51Z</dc:date>
    </item>
    <item>
      <title>(The forum killed my newline</title>
      <link>https://community.intel.com/t5/OpenCL-for-CPU/printf-with-get-global-id-uses-wrong-placeholder/m-p/969153#M2353</link>
      <description>&lt;P&gt;(The forum killed my newline escape character - of course I mean %u[backslash]n instead of %un)&lt;/P&gt;
&lt;P&gt;Versions:&lt;BR /&gt;[bash]&lt;BR /&gt;[@memphis:~] $ cat /etc/SuSE-release &lt;BR /&gt;SUSE Linux Enterprise Server 11 (x86_64)&lt;BR /&gt;VERSION = 11&lt;BR /&gt;PATCHLEVEL = 2&lt;BR /&gt;[@memphis:~] $ uname -a&lt;BR /&gt;Linux memphis 3.0.13-0.27-default #1 SMP Wed Feb 15 13:33:49 UTC 2012 (d73692b) x86_64 x86_64 x86_64 GNU/Linux&lt;BR /&gt;[@memphis:~] 1 $ rpm -qa |grep intel&lt;BR /&gt;intel-mic-2.1.6720-15.suse&lt;BR /&gt;intel-mic-mpm-2.1.6720-15.suse&lt;BR /&gt;opencl-1.2-intel-mic-3.0.67279-1&lt;BR /&gt;intel-mic-sysmgmt-2.1.6720-15.suse&lt;BR /&gt;intel-mic-kmod-2.1.6720-15.3.0.13.0.suse&lt;BR /&gt;intel-mic-gdb-2.1.6720-15.suse&lt;BR /&gt;intel-mic-flash-2.1.386-3.suse&lt;BR /&gt;intel-mic-cdt-2.1.6720-15.suse&lt;BR /&gt;opencl-1.2-intel-devel-3.0.67279-1&lt;BR /&gt;intel-mic-micmgmt-2.1.6720-15.3.0.13.0.suse&lt;BR /&gt;opencl-1.2-intel-cpu-3.0.67279-1&lt;BR /&gt;intel-mic-gpl-2.1.6720-15.suse&lt;BR /&gt;intel-mic-crashmgr-2.1.6720-15.suse&lt;BR /&gt;[/bash]&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Aug 2013 20:35:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/OpenCL-for-CPU/printf-with-get-global-id-uses-wrong-placeholder/m-p/969153#M2353</guid>
      <dc:creator>Markus_Dreseler</dc:creator>
      <dc:date>2013-08-05T20:35:00Z</dc:date>
    </item>
    <item>
      <title>Hi Markus,</title>
      <link>https://community.intel.com/t5/OpenCL-for-CPU/printf-with-get-global-id-uses-wrong-placeholder/m-p/969154#M2354</link>
      <description>Hi Markus,

I was able to reproduce this behavior. I will get back to you after analysis.

Thanks,
Yuri</description>
      <pubDate>Thu, 22 Aug 2013 13:56:39 GMT</pubDate>
      <guid>https://community.intel.com/t5/OpenCL-for-CPU/printf-with-get-global-id-uses-wrong-placeholder/m-p/969154#M2354</guid>
      <dc:creator>Yuri_K_Intel</dc:creator>
      <dc:date>2013-08-22T13:56:39Z</dc:date>
    </item>
    <item>
      <title>Markus,</title>
      <link>https://community.intel.com/t5/OpenCL-for-CPU/printf-with-get-global-id-uses-wrong-placeholder/m-p/969155#M2355</link>
      <description>Markus,

Regarding first issue:
printf("global id: %u global size: %u\\n", get_global_id(0), get_global_size(0));
// returns global id: 0 global size: 0 - why is get_global_size(0) = 0?
I think you need to specify %zu instead of just %u, since get_global_id and get_global_size functions return size_t type. The output becomes correct for me in this case.

Regarding second issue:
printf("global id: %u global size: %u unused var: %un", get_global_id(0), get_global_size(0));
// returns global id: 0 global size: 0 unused var: 1 - where does that 1 come from?
I have compiled a similar C program and its output was exactly the same. Per Microsoft's documentation (http://msdn.microsoft.com/en-us/library/vstudio/wc7014hz.aspx) - The results are undefined if there are not enough arguments for all the format specifications. So, I guess this is not a real issue for OpenCL implementation as well.

Thanks,
Yuri</description>
      <pubDate>Fri, 23 Aug 2013 12:47:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/OpenCL-for-CPU/printf-with-get-global-id-uses-wrong-placeholder/m-p/969155#M2355</guid>
      <dc:creator>Yuri_K_Intel</dc:creator>
      <dc:date>2013-08-23T12:47:00Z</dc:date>
    </item>
    <item>
      <title>Hi Yuri,</title>
      <link>https://community.intel.com/t5/OpenCL-for-CPU/printf-with-get-global-id-uses-wrong-placeholder/m-p/969156#M2356</link>
      <description>&lt;P&gt;Hi Yuri,&lt;/P&gt;
&lt;P&gt;Thank you for looking into it. Your explanation makes perfect sense. I never ran into %u returning wrong results, so I made a wrong assumption here.&lt;/P&gt;
&lt;P&gt;Best,&lt;BR /&gt;Markus&lt;/P&gt;</description>
      <pubDate>Tue, 27 Aug 2013 17:56:27 GMT</pubDate>
      <guid>https://community.intel.com/t5/OpenCL-for-CPU/printf-with-get-global-id-uses-wrong-placeholder/m-p/969156#M2356</guid>
      <dc:creator>Markus_Dreseler</dc:creator>
      <dc:date>2013-08-27T17:56:27Z</dc:date>
    </item>
    <item>
      <title>Hi,</title>
      <link>https://community.intel.com/t5/OpenCL-for-CPU/printf-with-get-global-id-uses-wrong-placeholder/m-p/969157#M2357</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I had the same problem, but the %zu was the solution.&lt;BR /&gt;
	Thanks for this post. Saved my day!&lt;/P&gt;</description>
      <pubDate>Thu, 18 Aug 2016 15:58:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/OpenCL-for-CPU/printf-with-get-global-id-uses-wrong-placeholder/m-p/969157#M2357</guid>
      <dc:creator>LSolis</dc:creator>
      <dc:date>2016-08-18T15:58:00Z</dc:date>
    </item>
  </channel>
</rss>

