Decreasing the fortran run time by extra optimization flags

Decreasing the fortran run time by extra optimization flags

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 from

Any help is highly appreciated.

Thank you so much.

Best Regards,


2 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

-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.)

Retired 12/31/2016

Leave a Comment

Please sign in to add a comment. Not a member? Join today