2

I am checking the CPU information on a Linux server, and tuning options of the Intel C compiler icc for my C code running on the server's specific architecture. I am thinking about choosing the value for the option -march in icc. The following is part of the content of /proc/cpuinfo/ for one core (same for the other cores), and which value should I give to -march for icc? Or should I use a different option than -march?

-march=<cpu> (i32, i64em only)
          Generate code exclusively for a given cpu.  For  this  release,
          the  <cpu>  values of pentiumii and pentiumiii have been depre-
          cated.  For a given cpu, <cpu> is one of the following:

         core2 -- Intel(R) Core(TM)2 processor family

         pentium4 -- Intel Pentium 4 processors

         pentium3 -- Intel Pentium III processors

The following is the output of cat /proc/cpuinfo on a Linux server

processor   : 0
vendor_id   : GenuineIntel
cpu family  : 6
model       : 26
model name  : Intel(R) Xeon(R) CPU           E5504  @ 2.00GHz
stepping    : 5
cpu MHz     : 1994.956
cache size  : 4096 KB
physical id : 1
siblings    : 4
core id     : 0
cpu cores   : 4
apicid      : 16
initial apicid  : 16
fpu     : yes
fpu_exception   : yes
cpuid level : 11
wp      : yes
flags       : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good xtopology nonstop_tsc aperfmperf pni dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm dca sse4_1 sse4_2 popcnt lahf_lm dts tpr_shadow vnmi flexpriority ept vpid
bogomips    : 3989.91
clflush size    : 64
cache_alignment : 64
address sizes   : 40 bits physical, 48 bits virtual
power management:
1

Unless you have a pressing need to target the older architectures of core2, pentium4, or pentium3 I would approach the situation like so. Run this command:

# 64-bit system
$ getconf LONG_BIT
64

# 32-bit system
$ getconf LONG_BIT
32

If your system returns 64 then use the -march switch i64em. If you get 32, then use i32.

excerpt from icc docs

Label      Meaning
i32        The option is available on systems using IA-32 architecture.
i64em      The option is available on systems using Intel� 64 architecture.
i64        The option is available on systems using IA-64 architecture.

What CPU do I have?

You can use the command line tool cpuid to get more details about a given system's CPU. There are other ways to get at this info as well, but this is my preferred method.

$ cpuid -1 | less
CPU:
   vendor_id = "GenuineIntel"
   version information (1/eax):
      processor type  = primary processor (0)
      family          = Intel Pentium Pro/II/III/Celeron/Core/Core 2/Atom, AMD Athlon/Duron, Cyrix M2, VIA C3 (6)
      model           = 0x5 (5)
      stepping id     = 0x5 (5)
      extended family = 0x0 (0)
      extended model  = 0x2 (2)
      (simple synth)  = Intel Core i3 / i5 / i7  (Clarkdale K0) / Pentium U5000 Mobile / Pentium P4505 / U3405 / Celeron Mobile P4000 / U3000 (Arrandale K0), 32nm
   miscellaneous (1/ebx):
      process local APIC physical ID = 0x5 (5)
      cpu count                      = 0x10 (16)
      CLFLUSH line size              = 0x8 (8)
      brand index                    = 0x0 (0)
...

References

  • Thanks! So does the CPU not belong to Intel(R) Core(TM)2 processor family? Which does it belong to? – Tim Feb 14 '14 at 10:34
  • @Tim - You have a Xeon processor, it covers all the prior families as well. Look at the output from my Intel i5 system. The command cpuid shows that all the prior families are covered by it as well, it shows this in the family line of the output. You generally only target the older families if you're planning on running the code there, and you don't want the compiler to use an optimization from the newer families. – slm Feb 14 '14 at 10:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.