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

problem compiling with -O3

ccorrado71
Beginner
1,026 Views
The intel fortran compiler doesn't seem able to compile the attached file elements.f90 with -O3 option.

If you try:

ifort -O3 -c elements.f90

the compiler never complete the operation.

No problem with -O2 or -O0 or with other fortran compilers.

Corrado
0 Kudos
5 Replies
TimP
Honored Contributor III
1,026 Views
Without your USE file, who can try to compile?
Which compiler version? Which OS? Does it use excessive memory?
It is usual to have to set -O1 for code resembling this.
0 Kudos
ccorrado71
Beginner
1,026 Views
I attach a new version of elements.f90 without 'USE strutil'.
Compiler version: 11.1.069_intel64
OS: Linux 2.6.31-20-generic (x86_64) Distro: Ubuntu 9.10 (karmic)
Memory: 6128MB (1390MB used)

-O1 is OK but why can not I compile with -O3.

Thank you very much.


0 Kudos
TimP
Honored Contributor III
1,026 Views
Various limits in the compiler are set so as to disable optimizations which are about to hang. Evidently, your case has found a weakness in both 32- and 64-bit 11.1 compilers.
When the compiler finds it has to cut back on optimization, it would usually go all the way back to -O0, so setting -O1 is preferable.
0 Kudos
Martyn_C_Intel
Employee
1,026 Views

Theres nothing unreasonable about the code, but it does include a large number of implied do loops (more than 600 all those constructors) in a single routine. O3 enables aggressive optimizations; I think the compiler is trying to merge many of these loops to improve runtime performance. Im not sure yet whether the compiler is truly stuck or (more likely) just taking a very long time; well investigate.

There are various ways to work around this; one would be to split the initialization routine load_chemical_elements into two parts. When I did this, it compiled in just under 4 minutes still rather slow, but not catastrophic.

However, this looks like an initialization routine that would be called only once, so there is really no need to compile it at O3, the default of O2 should be fine.

Well look into ways of restraining the compiler from trying to fuse together an unreasonably large number of loops.

Thanks for bringing this to our attention.

0 Kudos
Martyn_C_Intel
Employee
1,026 Views
This issue has been addressed in version 12 of the Intel compiler. The compiler no longer tries to fuse together large numbers of short trip count loops such as these. On the system I tested, your code compiled in about 3 minutes.
The 12.0 compiler may be obtained from http://registrationcenter.intel.com as part of Intel Composer XE for Linux.
0 Kudos
Reply