Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

which option of compiler should be used?

dingjun_chencmgl_ca
1,847 조회수

 

Hi, everyone,

I want to build our products with the specified instruction sets, but the Intel Fortran compiler offers us several options to specify the instruction sets, please see the following:

for example,

-march=CORE-AVX2      compiler option (only for Linux OS and OS X) and it is used to tell the Intel compiler to produce the AVX2 instruction sets when building the executable files.

and others:

x, Qx compiler option

ax, Qax compiler option
m compiler option
arch compiler option
 
 
I am confused aboute the use of above compiler options to specify the instruction sets in building the executable files. I want to know whether or not the  different above options could cause the difference performances of our products.
 
Could someone share your experiences with us?
 
Thanks in advance.
 
0 포인트
6 응답
TimP
명예로운 기여자 III
1,847 조회수
Arch options are Windows counterparts of m options. These options don't perform a run.time check on whether CPU is a qualifying Intel one but could hit illegal instructions on older CPU. Options with x perform such check. Ax options requests separate code path for older cpu
0 포인트
dingjun_chencmgl_ca
1,847 조회수

 

Thanks to you for your reply.

I have another problem for you.

Currently I am testing Haswell computers with different instruction sets to see if the latest Haswell computer is helpful to improve the performance of our products. The Haswell computer has 2-socket 28-core Intel(R) Xeon(R) CPU W5580 @ 3.20GHz.

I plan to use hybrid instruction sets to build our products. Our products are developed with Fortran. In our Fortran source codes, there are many loop statements. We hope that some loops are built with AVX2 instruction sets and some  loops are built with the default SSE2 instruction sets. For example,

I hope the following Fortran loop  statements are built as an AVX2 instruction sets:

                   ................................

                      do ieq = 1,neqi
                           v(ksol1+ieq) = bet(ksol+ieq) - vv(ksol1+ieq)
                           vq(ksol1+ieq,1) = v(ksol1+ieq)
                           tempc1 = tempc1 + v(ksol1+ieq)*v(ksol1+ieq)
                        enddo

                    ..........................................

I hope the following Fortran loop statements are built as a default SSE2 instruction sets:

                 ...............................................................
                 do ks = ksts(icatis(ica)+1)+1, kstscf(ica)
                     tempc1 = tempc1 + v(ks)*vq(ks,itt)
                  end do

                 ..................................................................

I am using the latest Intel Fortran compiler. Could you tell me whether or not my above plan is available for implementation via the Intel Fortran compiler?  if possible, please tell me how to instruct the Intel compiler in my Fortran source codes  to implement my above plan. Is there an OpenMP directive  or other way to help implement above plan?

I look forward to hearing from you and your reply is highly appreciated.

Best regards,

 

 

 

0 포인트
Steven_L_Intel1
1,847 조회수

Intel Fortran doesn't provide a way for you to restrict some code to particular instruction sets. Intel C++ can do this with "manual CPU dispatch". You can tell the compiler to generate up to three instruction streams, one generic (default is SSE2 but you can change this), and two Intel-specific, using the -ax option. For more information, see  Which compiler options should I use to optimize best for a specific Intel® processor?

0 포인트
Martyn_C_Intel
1,847 조회수

I don't understand what you are trying to achieve here. If part of your code is built with AVX2, it will only run on Haswell, so what is the point of building other parts with SSE? Whilst I think there might be a way to achieve your goal using explicit vector programming extensions, I would strongly advise against it. If you really want to build different parts of your program with different instruction sets, much easier to do it at the subroutine or source file level.

Note that Intel Advanced Vector Extensions (Intel AVX) include 128 bit instructions as well as 256 bit ones. If the compiler thinks that 128 bit instructions might perform better than 256, (e.g. if the loop trip count is small), it will generate 128 bit AVX instructions - no need to risk possible penalties from switching back and forth between AVX and SSE instructions. If you want to help the compiler, try adding a LOOP COUNT directive to advise it of typical value(s) of the loop trip count (number of iterations of the loop).

If what you want is to have the same code compiled both with AVX2 and with SSE, so that a single executable will run well of systems both with and without AVX2 support, then you should follow Steve's advice above (e.g. -axcore-avx2). If your executable will only run on Intel Haswell systems, then build with -xcore-avx2 and don't worry about SSE.

0 포인트
응답