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

Optimization Flags for ifort 9

Sangamesh_B_
Beginner
1,246 Views

Can any one tell me the optimization flags for ifort 9 compiler (for the latest Intel Quad Core processor).

--Sangamesh
0 Kudos
8 Replies
TimP
Honored Contributor III
1,246 Views
It's not at all critical, as long as you turn vectorization and openmp/parallel on or off according to your intentions. -xT would be most likely to use instructions available only on Core and not on earlier CPUs, if that is your desire. Either -xP or -xT would invoke SSE3. I normally used
ifort -xW -fp-model precise -ftz -openmp
For more aggressive optimization, add -O3. Even more aggressive, with less reliability, remove -fp-model precise.
Check the options shown under ifort -help and in the docs directory files.
0 Kudos
Steven_L_Intel1
Employee
1,246 Views
For ifort 9, I think the best you can do is -xP. ifort 9 does not have -fp-model.

If you are using a recent quad-core Intel processor, you would do well to use ifort 10.1 as well.
0 Kudos
TimP
Honored Contributor III
1,246 Views
-fp-model was introduced in ifort 9.1. ifort 10 gives you the alternative -assume protect_parens to avoid risky aggressive optimization.
0 Kudos
Sangamesh_B_
Beginner
1,246 Views
Amber 9 provides the -p4 switch for optimization in configuring.

I've seen flags: " -w95 -mp1 -ip -tpp7 -axWP" during compilation.

Now am using ifort10 compiler.

Since it is run on Xeon family processor(Woodcrest), I'm expecting still better
optimization flags rather than using p4 level optimization.

Can you name these flags..

-Sangamesh
0 Kudos
TimP
Honored Contributor III
1,246 Views
-w95 isn't an optimization flag; it's a warning about conflicts with f95 standard.
-mp1 is not advised since -fp-model precise was introduced in ifort 9.1. These options remove some aggressive default optimizations. With ifort 10, you have more control; you can accept more optimizations without breaking your code, by selecting among -assume protect-parens (treat parentheses in accordance with Fortran standard; this is the only one which is new with ifort 10) -prec-div (no approximations for divide) -prec-sqrt (no approximations for sqrt -ftz- (set IEEE gradual underflow). If the recommendation prior to 9.1 was -mp1, I would use -assume protect-parens -prec-div -prec-sqrt.
-ip has been the default for some time. It sets interprocedural optimization within each source file. -ipo invokes interprocedural optimizations among source files. It may or may not be more useful now than it was in earlier compilers.
-tpp7 has little or no meaning with recent compilers. It basically confirms defaults.
-axWP makes sense only if you are supporting 3 categories of CPU: those without SSE2, P4 CPUs, and SSE3. You would get better performance and consistent behavior by picking just one of those. -p4 would be equivalent to -xW (SSE2), which is the default for the Intel64 compilers. If your application benefits from SSE3, and you don't need to support non-SSE3, you would choose -xO or -xP. -xT uses some SSSE3, not consistently to good advantage.
0 Kudos
Sangamesh_B_
Beginner
1,246 Views
I added the flags -axT -fp-model precise -ftz -openmp with the existing -mp1 -ip -O3.

-axT because Woodcrest is a dualcore dual processor. Right?

During make following error occurred:
../obj/divcon.o(.text+0x7f9): In function `MAIN__':
: undefined reference to `__kmpc_end'

From googling, I decided to use -lguide.

But after this also it is giving same error.

The library flags used are:
loadlib="$loadlib -L$mkll -lvml -lmkl_lapack -lmkl -lguide -lpthread"

And this error is coming after using the optimization flags.

How to resolve this issue?

Also, what is exactly Core2 Duo? How it differs from dual core dual processor arch?


-Sangamesh
0 Kudos
TimP
Honored Contributor III
1,246 Views
Woodcrest is the dual socket counterpart of Core 2 Duo. The same compiler options are supported.
You shouldn't use both -mp1 and -fp-model options, the latter should be used from ifort 9.1 on. This isn't the cause of your problem of the moment.
It's better to use ifort -openmp -axT for the link to supply implicitly the options -lsvml -lguide -lpthread. You are correct, somehow you aren't linking the libguide.
The mkl link option depends on which MKL version you have.
0 Kudos
Steven_L_Intel1
Employee
1,246 Views
I'll caution that "Core 2 Duo" is a name applied to, at present, two different generations of processors. This tells you that it is the "Intel Core Microarchitecture" and is a dual-core. This could be the 65nm Merom/Conroe/Woodcrest family of processors, introduced in 2006, or the new 45nm Penryn family (which has additional names for dual and quad-core desktop and server processors). There are quad-core versions of these too.

Intel has other dual-core processors, including the "Core Duo" line (based on an enhanced Pentium M microarchitecture, not Intel Core Microarchitectire!) and various Pentium D and Xeon-branded processors based on the older Netburst (Pentium 4) microarchitecture.

It is difficult to relate the processor brand name with the appropriate instruction set generation switch. We've made an attempt in a support article, but just maintaining this is a never-ending task. It isn't helped when there are multiple generations sold under the same brand name and we're instructed to use such pithy phrases as "45nm Hi-k next generation Intel Core microarchitecture". We try the best we can.

On the flip side, we're likely going to restructure the -x and -ax options to use keywords that are more meaningful.
0 Kudos
Reply