Community
cancel
Showing results for 
Search instead for 
Did you mean: 
free1006
Beginner
100 Views

How to detect the CPU is INTEL or others?

I want to set the KMP_AFFINITY to NONE for AMD CPU, but don't know how to detect the CPU is INTEL or others.
I have tried somes windows API, seems not works.

Could some provide a code to me ?

Note: I don't want to use the WMI.

Thanks
0 Kudos
6 Replies
SergeyKostrov
Valued Contributor II
100 Views

Quoting free1006
I want to set the KMP_AFFINITY to NONE for AMD CPU, but don't know how to detect the CPU is INTEL or others.
I have tried somes windows API, seems not works.

Could some provide a code to me?

In case of using a'__cpuid' instruction you could look for a Vendor information:

...
RTint CPUInfo[4] = { -1, -1, -1, -1 };
RTchar CPUVendor[32] = { 0x0 };
RTuint nIds = 0;
...

...
__cpuid( CPUInfo, 0 );

nIds = CPUInfo[0];
CrtMemset( CPUVendor, 0x0, sizeof( CPUVendor ) );

*( ( RTint * )( CPUVendor )) = CPUInfo[1];
*( ( RTint * )( CPUVendor+4 )) = CPUInfo[3];
*( ( RTint * )( CPUVendor+8 )) = CPUInfo[2];
...
CrtPrintfA( "\tCPU Vendor : %s\n", CPUVendor );
...

and output could look like:

...
CPU Vendor : GenuineIntel
...

Best regards,
Sergey

free1006
Beginner
100 Views

Thank you very much.
Thomas_Jensen1
Beginner
100 Views

Its not KMP_AFFINITY=NONE but KMP_AFFINITY=DISABLED

I use (Delphi):

if CPUID.CpuType<>CPU_TYPE_INTEL then
SetEnvironmentVariable('KMP_AFFINITY','disabled'); // to disable annoying cmd box on non-Intel systems...

CPUID is a global object from the JCL library (opensource).

SergeyKostrov
Valued Contributor II
100 Views

I wonder how a call to a'__cpuid'will work on a computer with AMD CPU? Could somebody try it?
free1006
Beginner
100 Views

I have tried, the KMP_AFFINITY=DISABLED is not works, the KMP_AFFINITY=NONE works fine.


Thomas_Jensen1
Beginner
100 Views

Sorry, I should be more precise: since IPP 7.0.7, KMP_AFFINITY=DISABLED is the correct way, between 7.0.0 and <=7.0.6 KMP_AFFINITY=NONE is correct.

Reply