What do you do with NUMA?
Moderators: hgm, Rebel, chrisw
-
- Posts: 5566
- Joined: Tue Feb 28, 2012 11:56 pm
Re: What do you do with NUMA?
You need to detect HT and it is quite trivial.
-
- Posts: 2684
- Joined: Sat Jun 14, 2008 9:17 pm
Re: What do you do with NUMA?
Ok, care to provide some working code or for you was just enough to make me smile?syzygy wrote:You need to detect HT and it is quite trivial.
-
- Posts: 2559
- Joined: Fri Nov 26, 2010 2:00 pm
- Location: Czech Republic
- Full name: Martin Sedlak
Re: What do you do with NUMA?
it's bit 28 in edx (feature bits) in cpuid after eax=1Ok, care to provide some working code or for you was just enough to make me smile?
-
- Posts: 2684
- Joined: Sat Jun 14, 2008 9:17 pm
Re: What do you do with NUMA?
Is not so simple:mar wrote:it's bit 28 in edx (feature bits) in cpuid after eax=1Ok, care to provide some working code or for you was just enough to make me smile?
https://software.intel.com/en-us/forums ... pic/294575
http://wiki.osdev.org/Detecting_CPU_Topology_(80x86)
http://stackoverflow.com/questions/7274 ... ed-core-id
-
- Posts: 2684
- Joined: Sat Jun 14, 2008 9:17 pm
Re: What do you do with NUMA?
I explain better, our aim is to set the thread affinity to different physical cores, so I need to know if CPUX is on a different core than CPUYmcostalba wrote: Is not so simple:
-
- Posts: 2559
- Joined: Fri Nov 26, 2010 2:00 pm
- Location: Czech Republic
- Full name: Martin Sedlak
Re: What do you do with NUMA?
I see, I thought you only need to detect HT.mcostalba wrote:I explain better, our aim is to set the thread affinity to different physical cores, so I need to know if CPUX is on a different core than CPUYmcostalba wrote: Is not so simple:
Aren't the logical cores interleaved? Like each two logical cores are 1 physical (at least affinity on Windows seems to work this way, also mentioned in one othe links you sent)
This assumption might not hold in the future though...
-
- Posts: 5566
- Joined: Tue Feb 28, 2012 11:56 pm
Re: What do you do with NUMA?
Thanks for biting. The numa patch already does it.mcostalba wrote:Ok, care to provide some working code or for you was just enough to make me smile?syzygy wrote:You need to detect HT and it is quite trivial.
-
- Posts: 2684
- Joined: Sat Jun 14, 2008 9:17 pm
-
- Posts: 20943
- Joined: Mon Feb 27, 2006 7:30 pm
- Location: Birmingham, AL
Re: What do you do with NUMA?
I side with Marco here. There are TWO issues:mcostalba wrote:Is not so simple:mar wrote:it's bit 28 in edx (feature bits) in cpuid after eax=1Ok, care to provide some working code or for you was just enough to make me smile?
https://software.intel.com/en-us/forums ... pic/294575
http://wiki.osdev.org/Detecting_CPU_Topology_(80x86)
http://stackoverflow.com/questions/7274 ... ed-core-id
(1) is hyper threading in use? This is trivial with CPUID
(2) which processor numbers share a physical core. This is NOT so trivial as it has changed multiple times over the past 10 years. I spent a lot of time on this and finally said "hell with it..." I ended up making my thread affinity user-controllable so that I can tell it which processor IDs are REAL cores...
-
- Posts: 20943
- Joined: Mon Feb 27, 2006 7:30 pm
- Location: Birmingham, AL
Re: What do you do with NUMA?
I have seen the following:mar wrote:I see, I thought you only need to detect HT.mcostalba wrote:I explain better, our aim is to set the thread affinity to different physical cores, so I need to know if CPUX is on a different core than CPUYmcostalba wrote: Is not so simple:
Aren't the logical cores interleaved? Like each two logical cores are 1 physical (at least affinity on Windows seems to work this way, also mentioned in one othe links you sent)
This assumption might not hold in the future though...
10 physical cores. With HT enabled, you get 20 logical cores, numbered 0-19. Which share a core?
(1) 0 and 1, 2 and 3, etc.
(2) 0 and 10, 1 and 11, etc.
BOTH happen. And of course, then there is IBM with 20 logical cores per physical core.
And once upon a time, when there was a non-power-of-two number of physical cores, all bets were off in both linux and windows.