Lahey Fortran

Optimization and Parallelizing

Optimization

The purpose of optimization is to create an executable that runs as fast as possible without compromising the accuracy of the results. When the Release Configuration is selected, a moderate amount of optimization is applied. Most of the time, execution times can improve by increasing optimization.

Optimizations are set using the Optimization property page.

The basic optimization levels are set using the Optimization property.

Optimization level increases from O1 through O3 to Ofast, which generates the fastest code.

In addition to general optimizations, a number of loop optimizations are provided. The most effective loop optimization for most cases is loop unrolling.

Try experimenting with other loop optimizations, they can be effective in special cases.

Parallelizing

In addition to other loop optimizations, the compiler provides the ability to parallelize loops. Loops may be manually parallelized using Open MP directives in source, or the compiler can analyze your code and automatically perform parallelization. How effective the compiler may be in automatic parallelizing depends to a large degree on the code to be parallelized. Highly complex code or code with tangled logic will likely run slower when parallelizing is enabled. Experimentation is the only way to tell for sure.

To get the compiler to parallelize the code, set the Parallelization property to true.

Then set the Threshold For Auto-Parallelization property to the number of threads you wish to create. Do not set the threshold for autoparallelization to a number greater than the number of processors in the target system.

See Also

Configurations
Setting Build Options