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

Decreasing the fortran run time by extra optimization flags

jdbaba
Beginner
507 Views

I have been trying to optimize my program for some time now. It has more than 100 subroutines. The optimization flags I have used so far are as follows.

Optimization flag Time of completion

-c                        0.190 hr

-O3                     0.185 hr

-fast                     0.155 hr

So, using the optimization flag "-fast" I was able to gain 18.42% speed. I was wondering are there any other optimization flag that I can try to make my program run even faster. Because right now, when I ran my program with just O2 flag for one of my problem, it took around 25 hours to finish. I really need to increase the computational efficiency.

I found the information about the "-fast" flag fromhttps://support.scinet.utoronto.ca/wiki/images/7/77/Snug_techtalk_compiler.pdf

Any help is highly appreciated.

Thank you so much.

Best Regards,

Jdbaba

0 Kudos
1 Reply
Steven_L_Intel1
Employee
507 Views

-fast is simply shorthand for a collection of options that we find generally improve performance. It is documented and, on Linux, is equivalent to:

-ipo, -O3, -no-prec-div, -static, and -xHost

You need to be aware that -xHost specifies that the compiler should use the best available instruction set for the CPU on which you compile the program. This is fine when you know you are going to run the program on the same CPU, but if you will be running it on other CPUs, you don't want to use -xHost.

I would strongly recommend you look into parallelization, whether through OpenMP, pthreads or the compiler's autoparallel feature.  Try adding -parallel and see what you get. You should also investigate Profile Guided Optimization (see the compiler documentation) and use -guide to get advice on minor source changes you can make that can aid performance. (With -guide you will not get an executable.)

0 Kudos
Reply