Intel® Integrated Performance Primitives
Deliberate problems developing high-performance vision, signal, security, and storage applications.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.

How to detect the CPU is INTEL or others?

free1006
Beginner
1,389 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
1,389 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
1,389 Views
Thank you very much.
0 Kudos
Thomas_Jensen1
Beginner
1,389 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
1,389 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
1,389 Views
I have tried, the KMP_AFFINITY=DISABLED is not works, the KMP_AFFINITY=NONE works fine.


0 Kudos
Thomas_Jensen1
Beginner
1,389 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