Processors
Intel® Processors, Tools, and Utilities
14539 Discussions

How to correctly determine -march and -mtune for Intel processors?

JRobe48
Beginner
3,018 Views

I am currently building a software from source that is performance critical for me. Therefore I want to optimize it for running on my specific Intel CPUs. The building process requires that I set the -march and -mtune flag.

If on my processor node i use

 

gcc -march=native -Q --help=target|grep march gcc -mtune=native -Q --help=target|grep mtune

 

I get "core-avx2" for march and "generic" for mtune. However with Official Website

 

cat /proc/cpuinfo

 

 

I get:

 

processor : 23 vendor_id : GenuineIntel cpu family : 6 model : 63 model name : Intel(R) Xeon(R) CPU E5-2670 v3 @ 2.30GHz stepping : 2 microcode : 0x3d cpu MHz : 2599.993 cache size : 30720 KB physical id : 1 siblings : 12 core id : 13 cpu cores : 12 apicid : 58 initial apicid : 58 fpu : yes fpu_exception : yes cpuid level : 15 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt xsave avx f16c rdrand lahf_lm abm epb intel_ppin ssbd ibrs ibpb tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid cqm xsaveopt cqm_llc cqm_occup_llc dtherm ida arat pln pts bogomips : 4599.35 clflush size : 64 cache_alignment : 64 address sizes : 46 bits physical, 48 bits virtual power management:  

By going to the homepage of Intel(R) Xeon(R) CPU E5-2670 v3 @ 2.30GHz (https://ark.intel.com/content/www/de/de/ark/products/81709/intel-xeon-processor-e5-2670-v3-30m-cache-2-30-ghz.html) I found out: Codename -> Products formerly haswell

 

If I use

 

gcc -march=haswell -Q --help=target|grep march gcc -mtune=haswell -Q --help=target|grep mtune

 

I get "haswell" for both. So shouldn't I actually use haswell as march instead of core-avx2? What is the best possible choice?

 

Btw, I am using GCC 4.8.5 on CentOS7.

 

Thanks!

 

0 Kudos
4 Replies
JoseH_Intel
Moderator
2,851 Views

Hello JRobe48,

 

Thank you for joining the community

 

Let me check with our engineering team for the most recommended setting for -march and -mtune for a Intel(R) Xeon(R) CPU E5-2670 v3 @ 2.30GHz.

We will get back to you as soon as we receive updates from them

 

Regards.

 

Jose A.

Intel Customer Support Technician

A Contingent Worker at Intel

0 Kudos
JoseH_Intel
Moderator
2,851 Views

Hello JRobe48,

 

Thanks for your patience. I finally got info from our engineering team about the -march and -mtune flags.

 

You should use "core-avx2" with GCC 4.8.5.

 

GCC 4.9.0 renamed to "haswell" per https://gcc.gnu.org/gcc-4.9/changes.html :

 

New Targets and Target Specific Improvements

IA-32/x86-64

Optimizing for other Intel microarchitectures have been renamed to -march=nehalem, westmere, sandybridge, ivybridge, haswell, bonnell.

 

Hope this helps

 

Jose A.

Intel Customer Support Technician

A Contingent Worker at Intel

 

0 Kudos
JoseH_Intel
Moderator
2,851 Views

Hello JRobe48,

 

I am just following up to double check if you found the provided information useful. If you have further questions please don't hesitate to ask. If you consider the issue to be completed please let us know so we can proceed to mark this thread as resolved. This support interaction will be marked as resolved automatically in the next 72 hours if no activity is received.

 

Regards

 

Jose A.

Intel Customer Support Technician

A Contingent Worker at Intel

0 Kudos
JoseH_Intel
Moderator
2,851 Views

Hello JRobe48,

 

We will proceed to mark this thread as resolved. If you have further issues or questions just go ahead and create a new topic.

 

Regards

 

Jose A.

Intel Customer Support Technician

A Contingent Worker at Intel

 

0 Kudos
Reply