flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
Kuemmel 23 Dec 2008, 14:37
Hi folks,
inspired by the JuliaSSE code and still on the search for code that counts any logical cpu core including the virtual ones by hyper threading, I tried to do this with the proposed GetProcessAffinityMask, see the code attached. As I'm really not into OS-coding...is that the way to do it correctly ? For example on a normal Core2Quad it should display '4', on any i7 there shoud be '8', on any Dual Core2Quad there should be also '8'...and so on...hope you get what I mean. I could only test it on a Core2Duo. I commented out also a way I think how it would be done with CPUID, but Revolution didn't recommend that...so any comments/corrections welcome...
|
|||||||||||
![]() |
|
bitRAKE 24 Dec 2008, 07:20
For the sake of obtaining the highest speed, I've looked into the NUMA support on windows [AMD]. Numa can provide more detailed information about the relationships between cores and (cache) memory.
Code: # Constituent CPUs Relationship Parameters 0 CPU-0 Processor 1 CPU-0 Level 1 Data Cache Associativity 8 LineSize 64 Size 32KB 2 CPU-0 Level 1 Instruction Cache Associativity 8 LineSize 64 Size 32KB 3 CPU-1 Processor 4 CPU-1 Level 1 Data Cache Associativity 8 LineSize 64 Size 32KB 5 CPU-1 Level 1 Instruction Cache Associativity 8 LineSize 64 Size 32KB 6 CPU-0 CPU-1 Level 2 Unified Cache Associativity 24 LineSize 64 Size 6MB 7 CPU-2 Processor 8 CPU-2 Level 1 Data Cache Associativity 8 LineSize 64 Size 32KB 9 CPU-2 Level 1 Instruction Cache Associativity 8 LineSize 64 Size 32KB 10 CPU-0 - CPU-3 Shared Physical Package 11 CPU-3 Processor 12 CPU-3 Level 1 Data Cache Associativity 8 LineSize 64 Size 32KB 13 CPU-3 Level 1 Instruction Cache Associativity 8 LineSize 64 Size 32KB 14 CPU-2 CPU-3 Level 2 Unified Cache Associativity 24 LineSize 64 Size 6MB 15 CPU-4 Processor 16 CPU-4 Level 1 Data Cache Associativity 8 LineSize 64 Size 32KB 17 CPU-4 Level 1 Instruction Cache Associativity 8 LineSize 64 Size 32KB 18 CPU-5 Processor 19 CPU-5 Level 1 Data Cache Associativity 8 LineSize 64 Size 32KB 20 CPU-5 Level 1 Instruction Cache Associativity 8 LineSize 64 Size 32KB 21 CPU-4 CPU-5 Level 2 Unified Cache Associativity 24 LineSize 64 Size 6MB 22 CPU-6 Processor 23 CPU-6 Level 1 Data Cache Associativity 8 LineSize 64 Size 32KB 24 CPU-6 Level 1 Instruction Cache Associativity 8 LineSize 64 Size 32KB 25 CPU-4 - CPU-7 Shared Physical Package 26 CPU-7 Processor 27 CPU-7 Level 1 Data Cache Associativity 8 LineSize 64 Size 32KB 28 CPU-7 Level 1 Instruction Cache Associativity 8 LineSize 64 Size 32KB 29 CPU-6 CPU-7 Level 2 Unified Cache Associativity 24 LineSize 64 Size 6MB 30 CPU-0 - CPU-7 NUMA Node 0 Free Memory 10,217MB |
|||
![]() |
|
f0dder 28 Dec 2008, 04:30
You either have to use some specific OS routines, or do CPUID (if you don't care about non-x86). GetProcessAffinityMask() is not the way to go.
Also, don't hardcore stuff too much, give users configurability. P4 HT != core i7 HT != 1g multicore != multi-cpu != 2g multicore. |
|||
![]() |
|
revolution 28 Dec 2008, 04:41
f0dder wrote: GetProcessAffinityMask() is not the way to go. What do you suggest is "the way to go"? |
|||
![]() |
|
f0dder 28 Dec 2008, 05:00
GetProcessAffinityMask() only tells you what Windows has decided. I haven't owned a HT CPU, but my guess is you can do better with a combo of CPUID topology querying and user config...
unless all windows versions have really well-working topology detection. And keep in mind that all current windows versions are pre core-i7, which HT implementation is supposed to be a lot different than P4 HT. And older windows versions can't differentiate HT from MP from MC... ![]() |
|||
![]() |
|
revolution 28 Dec 2008, 05:20
f0dder wrote: GetProcessAffinityMask() only tells you what Windows has decided. You also said: f0dder wrote: You either have to use some specific OS routines ... |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.