UW AMath High Performance Scientific Computing
 
AMath 483/583 Class Notes
 
Spring Quarter, 2011

Table Of Contents

Previous topic

Fortran Input / Output

Next topic

Optimizing Fortran

This Page

Optimizing code

See Rotating particles and Python efficiency and Rotating particles and Fortran efficiency for some comments on writing programs that run quickly.

See Optimizing Fortran for some simple examples of Fortran optimization.

Compiler such as gfortran can automatically perform some optimizations. The level of optimization is typically denoted by the -O flag, and -O3 is commonly used. See Rotating particles and Fortran efficiency for examples of this in action, including a case where using -O3 makes the code run slower, which can happen.

Note that optimization normally has to be turned off in order to use a debugger on the code, in which case it should be compiled with the -g flag instead to produce more information that can be used by debuggers like gdb.

Further reading