Intel® Integrated Performance Primitives
Deliberate problems developing high-performance vision, signal, security, and storage applications.
6704 Discussions

How to detect the CPU is INTEL or others?

free1006
Beginner
561 Views
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
561 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

0 Kudos
free1006
Beginner
561 Views
Thank you very much.
0 Kudos
Thomas_Jensen1
Beginner
561 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).

0 Kudos
SergeyKostrov
Valued Contributor II
561 Views
I wonder how a call to a'__cpuid'will work on a computer with AMD CPU? Could somebody try it?
0 Kudos
free1006
Beginner
561 Views
I have tried, the KMP_AFFINITY=DISABLED is not works, the KMP_AFFINITY=NONE works fine.


0 Kudos
Thomas_Jensen1
Beginner
561 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.

0 Kudos
Reply