<?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 Re: How can i know which core is running in Intel® Moderncode for Parallel Architectures</title>
    <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/How-can-i-know-which-core-is-running/m-p/861531#M2408</link>
    <description>Wish you solve the problem as soon as possible!&lt;BR /&gt;</description>
    <pubDate>Mon, 05 Jul 2010 03:56:56 GMT</pubDate>
    <dc:creator>yuanyuan3558</dc:creator>
    <dc:date>2010-07-05T03:56:56Z</dc:date>
    <item>
      <title>How can i know which core is running</title>
      <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/How-can-i-know-which-core-is-running/m-p/861524#M2401</link>
      <description>&lt;BR /&gt;Hi all, I am now doing research on a 4x4 machine. I want to know what cores are running in each thread . Beside , I want to find out whether the 4 cores running in the same thread are on the same die , is there anyone who knows how to do this ? Thank you very much!&lt;BR /&gt;</description>
      <pubDate>Tue, 08 Jul 2008 08:31:39 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/How-can-i-know-which-core-is-running/m-p/861524#M2401</guid>
      <dc:creator>ringoguo</dc:creator>
      <dc:date>2008-07-08T08:31:39Z</dc:date>
    </item>
    <item>
      <title>Re: How can i know which core is running</title>
      <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/How-can-i-know-which-core-is-running/m-p/861525#M2402</link>
      <description>See the previous answer on similar subject. If you don't set affinity, the threads likely won't stay put long enough for a meaningful diagnosis, even if you found a way. It's usually more interesting to evaluate how performance depends on the way you allocate the threads, for example by the linux tools taskset or numactl, or Windows task manager, or by threading library function calls.&lt;BR /&gt;Equivalent facilities (typically environment variables) are provided by OpenMP implementations (Intel KMP_AFFINITY, gnu GOMP_AFFINITY) or MPI (e.g. IMPI_PIN_DOMAIN, IMPI_PIN_PROCS)&lt;BR /&gt;</description>
      <pubDate>Tue, 08 Jul 2008 12:48:37 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/How-can-i-know-which-core-is-running/m-p/861525#M2402</guid>
      <dc:creator>TimP</dc:creator>
      <dc:date>2008-07-08T12:48:37Z</dc:date>
    </item>
    <item>
      <title>Re: How can i know which core is running</title>
      <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/How-can-i-know-which-core-is-running/m-p/861526#M2403</link>
      <description>Yes , I know I have to set affinity. But i want to know whether an existing software is clever enough to allocate cores on the same die to a thread , that's why I need to know the logical ids of the cores and the information whether they are on the same die. Evaluating the performance is not enough for me here.&lt;BR /&gt;ps : task manager is not reliable , sometimes it will give you the wrong message.&lt;BR /&gt;</description>
      <pubDate>Tue, 08 Jul 2008 15:48:10 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/How-can-i-know-which-core-is-running/m-p/861526#M2403</guid>
      <dc:creator>ringoguo</dc:creator>
      <dc:date>2008-07-08T15:48:10Z</dc:date>
    </item>
    <item>
      <title>Re: How can i know which core is running</title>
      <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/How-can-i-know-which-core-is-running/m-p/861527#M2404</link>
      <description>&lt;P&gt;Just a rough sketch of an idea to consider.&lt;/P&gt;
&lt;P&gt;If you can attach a callback routine to the process you would be interested in, then you solve half the problem.&lt;/P&gt;
&lt;P&gt;In the callback process, you can call an OS API to get affinity info, alternately you execute CPUID instruction to query initial APID of current thread context.When your target isa multi-threaded app, the DLL insertion may have to be sophisticated enough to walk thru each thread context owned by the process. Natually, your callback should not alter affinity setting.&lt;/P&gt;
&lt;P&gt;Based on the initial APIC ID of each thread context, and its evolution across OS scheduler quanta, you can compare that to a system map of the CPU topology. The system map of the CPU topology can be done separately, do not inject a system topology map query as part of the dll toyour target app callback, or run currently when you're studying your target app. You should produce the system topology map before or after you're done with your injection study. Because, system topology map will not change after BIOS initialization until reboot (current OS do not suppot hot-add/ hot-removal of CPU). Producing a system topology map requires modifying affinity setting across all logical processors.&lt;/P&gt;
&lt;P&gt;The reference coderelated to the white paper, can be used to produce your system topology map. See&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.intel.com/en-us/articles/article_nice_name"&gt;http://software.intel.com/en-us/articles/intel-64-architecture-processor-topology-enumeration&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Jul 2008 17:38:02 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/How-can-i-know-which-core-is-running/m-p/861527#M2404</guid>
      <dc:creator>SHIH_K_Intel</dc:creator>
      <dc:date>2008-07-24T17:38:02Z</dc:date>
    </item>
    <item>
      <title>Re: How can i know which core is running</title>
      <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/How-can-i-know-which-core-is-running/m-p/861528#M2405</link>
      <description>&lt;P&gt;&lt;FONT face="Courier New" size="4"&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;DIV&gt;&lt;IMG src="https://community.intel.com/file/6745" /&gt; &lt;STRONG&gt;ringoguo:&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="4"&gt;Hi all, I am now doing research on a 4x4 machine. I want to know what cores are running in each thread . Beside , I want to find out whether the 4 cores running in the same thread are on the same die , is there anyone who knows how to do this ? Thank you very much!&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="4"&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="4"&gt;&lt;BR /&gt;Depends on OS.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="4"&gt;On Windows Vista you can use &lt;/FONT&gt;&lt;FONT face="Courier New" size="4"&gt;GetCurrentProcessorNumber().&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="4"&gt;On Linux you can use vgetcpu().&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="4"&gt;If they are not available, you can try to use:&lt;BR /&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="4"&gt;&lt;PRE&gt;&lt;SPAN class="kw"&gt;__declspec&lt;/SPAN&gt;(naked) &lt;SPAN class="kw"&gt;unsigned&lt;/SPAN&gt; get_current_proc()&lt;BR /&gt;{&lt;BR /&gt;    &lt;SPAN class="kw"&gt;__asm&lt;/SPAN&gt;&lt;BR /&gt;    {&lt;BR /&gt;        mov ecx, 03Bh&lt;BR /&gt;        lsl eax, ecx&lt;BR /&gt;        shr eax, 0Eh&lt;BR /&gt;        retn&lt;BR /&gt;    }&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;But this will likely be working only on Windows Vista.&lt;BR /&gt;&lt;BR /&gt;Under Windows XP you can try to use:&lt;BR /&gt;&lt;PRE&gt;&lt;SPAN class="kw"&gt;unsigned&lt;/SPAN&gt;* idt_table;&lt;BR /&gt;&lt;SPAN class="kw"&gt;unsigned&lt;/SPAN&gt; idt_table_size;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN class="kw"&gt;__declspec&lt;/SPAN&gt;(thread) &lt;SPAN class="kw"&gt;unsigned&lt;/SPAN&gt; thread_cache_idt;&lt;BR /&gt;&lt;SPAN class="kw"&gt;__declspec&lt;/SPAN&gt;(thread) &lt;SPAN class="kw"&gt;unsigned&lt;/SPAN&gt; thread_cache_proc;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN class="kw"&gt;unsigned&lt;/SPAN&gt; get_current_processor()&lt;BR /&gt;{&lt;BR /&gt;&lt;SPAN class="kw"&gt;#pragma&lt;/SPAN&gt; pack(push, 1)&lt;BR /&gt;    &lt;SPAN class="kw"&gt;struct&lt;/SPAN&gt; idt_t&lt;BR /&gt;    {&lt;BR /&gt;        &lt;SPAN class="kw"&gt;unsigned short&lt;/SPAN&gt; size;&lt;BR /&gt;        &lt;SPAN class="kw"&gt;unsigned&lt;/SPAN&gt; base;&lt;BR /&gt;    };&lt;BR /&gt;&lt;SPAN class="kw"&gt;#pragma&lt;/SPAN&gt; pack(pop)&lt;BR /&gt;&lt;BR /&gt;    idt_t idt;&lt;BR /&gt;    __sidt(&amp;amp;idt);&lt;BR /&gt;    &lt;SPAN class="kw"&gt;if&lt;/SPAN&gt; (idt.base != thread_cache_idt)&lt;BR /&gt;    {&lt;BR /&gt;        &lt;SPAN class="kw"&gt;for&lt;/SPAN&gt; (&lt;SPAN class="kw"&gt;unsigned&lt;/SPAN&gt; i = 0; i != idt_table_size; ++i)&lt;BR /&gt;        {&lt;BR /&gt;            &lt;SPAN class="kw"&gt;if&lt;/SPAN&gt; (idt_table&lt;I&gt; == idt.base)&lt;BR /&gt;            {&lt;BR /&gt;                thread_cache_idt = idt.base;&lt;BR /&gt;                thread_cache_proc = i;&lt;BR /&gt;                &lt;SPAN class="kw"&gt;break&lt;/SPAN&gt;;&lt;BR /&gt;            }&lt;BR /&gt;        }&lt;BR /&gt;    }&lt;BR /&gt;    &lt;SPAN class="kw"&gt;return&lt;/SPAN&gt; thread_cache_proc;&lt;BR /&gt;}&lt;/I&gt;&lt;/PRE&gt;Or:&lt;BR /&gt;&lt;PRE&gt;&lt;SPAN class="kw"&gt;struct&lt;/SPAN&gt; current_processor_t&lt;BR /&gt;{&lt;BR /&gt;    &lt;SPAN class="kw"&gt;unsigned&lt;/SPAN&gt; number;&lt;BR /&gt;    &lt;SPAN class="kw"&gt;unsigned&lt;/SPAN&gt; timestamp;&lt;BR /&gt;    &lt;SPAN class="kw"&gt;unsigned&lt;/SPAN&gt; period;&lt;BR /&gt;};&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN class="kw"&gt;__declspec&lt;/SPAN&gt;(thread) current_processor_t current_processor = {0, 0, 1};&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN class="kw"&gt;__declspec&lt;/SPAN&gt;(noinline) &lt;SPAN class="kw"&gt;void&lt;/SPAN&gt; update_current_processor()&lt;BR /&gt;{&lt;BR /&gt;    current_processor_t&amp;amp; cp = current_processor;&lt;BR /&gt;    cp.timestamp = *(&lt;SPAN class="kw"&gt;unsigned&lt;/SPAN&gt;*)0x7FFE0000; &lt;SPAN class="com"&gt;// tick count&lt;/SPAN&gt;&lt;BR /&gt;    cp.period = 10; &lt;SPAN class="com"&gt;// subject to tweaking&lt;/SPAN&gt;&lt;BR /&gt;    &lt;SPAN class="kw"&gt;unsigned&lt;/SPAN&gt; proc;&lt;BR /&gt;    &lt;SPAN class="kw"&gt;__asm&lt;/SPAN&gt;&lt;BR /&gt;    {&lt;BR /&gt;        mov eax, 1;&lt;BR /&gt;        cpuid;&lt;BR /&gt;        shr ebx, 24;&lt;BR /&gt;        mov proc, ebx;&lt;BR /&gt;    }&lt;BR /&gt;    cp.number = proc;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN class="kw"&gt;unsigned&lt;/SPAN&gt; get_current_processor(
)&lt;BR /&gt;{&lt;BR /&gt;    current_processor_t&amp;amp; cp = current_processor;&lt;BR /&gt;    &lt;SPAN class="kw"&gt;if&lt;/SPAN&gt; (0 == --cp.period || cp.timestamp != *(&lt;SPAN class="kw"&gt;unsigned&lt;/SPAN&gt;*)0x7FFE0000)&lt;BR /&gt;        update_current_processor();&lt;BR /&gt;    &lt;SPAN class="kw"&gt;return&lt;/SPAN&gt; cp.number;&lt;BR /&gt;}&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/PRE&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="4"&gt;Dmitriy V'jukov&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 02 Aug 2008 18:41:09 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/How-can-i-know-which-core-is-running/m-p/861528#M2405</guid>
      <dc:creator>Dmitry_Vyukov</dc:creator>
      <dc:date>2008-08-02T18:41:09Z</dc:date>
    </item>
    <item>
      <title>Re: How can i know which core is running</title>
      <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/How-can-i-know-which-core-is-running/m-p/861529#M2406</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;DIV&gt;&lt;IMG src="https://community.intel.com/file/6745" /&gt; &lt;STRONG&gt;ringoguo:&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;BR /&gt;Hi all, I am now doing research on a 4x4 machine. I want to know what cores are running in each thread . Beside , I want to find out whether the 4 cores running in the same thread are on the same die , is there anyone who knows how to do this ? Thank you very much!&lt;BR /&gt;&lt;/DIV&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;Oh, and on AMD processors you can use &lt;FONT size="2"&gt;RDTSCP (Read Time-Stamp Counter and Processor ID) instruction.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Dmitriy V'jukov&lt;BR /&gt;&lt;/FONT&gt;</description>
      <pubDate>Sat, 02 Aug 2008 18:43:46 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/How-can-i-know-which-core-is-running/m-p/861529#M2406</guid>
      <dc:creator>Dmitry_Vyukov</dc:creator>
      <dc:date>2008-08-02T18:43:46Z</dc:date>
    </item>
    <item>
      <title>Re: How can i know which core is running</title>
      <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/How-can-i-know-which-core-is-running/m-p/861530#M2407</link>
      <description>RDTSCP is available on Nehalem architecture, too. A description is available in Section 16.11.2 of the Intel 64 and IA-32 Architectures Software Developers Manual, Volume 3A: System Programming Guide, Part 1, which is available &lt;A href="http://www.intel.com/Assets/pdf/manual/253668.pdf"&gt;here&lt;/A&gt;.&lt;BR /&gt;&lt;BR /&gt;Kind regards&lt;BR /&gt;Thomas</description>
      <pubDate>Fri, 02 Jul 2010 14:54:33 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/How-can-i-know-which-core-is-running/m-p/861530#M2407</guid>
      <dc:creator>Thomas_W_Intel</dc:creator>
      <dc:date>2010-07-02T14:54:33Z</dc:date>
    </item>
    <item>
      <title>Re: How can i know which core is running</title>
      <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/How-can-i-know-which-core-is-running/m-p/861531#M2408</link>
      <description>Wish you solve the problem as soon as possible!&lt;BR /&gt;</description>
      <pubDate>Mon, 05 Jul 2010 03:56:56 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/How-can-i-know-which-core-is-running/m-p/861531#M2408</guid>
      <dc:creator>yuanyuan3558</dc:creator>
      <dc:date>2010-07-05T03:56:56Z</dc:date>
    </item>
  </channel>
</rss>

