HP Fortran Programmer's Guide (September 2007)
Compiling and linking
Special-purpose compilations
Chapter 292
WRITE (6, FMT='(A)', ADVANCE='NO') 'Enter a real number:'
READ *, x
PRINT *, 'x =', double_it(x)
END PROGRAM main
REAL FUNCTION double_it(arg)
REAL :: arg
double_it = 2.0 * arg
END FUNCTION double_it
Creating demand-loadable executables
By default, the loader loads the entire code for an executable program into virtual memory.
For very large programs, this can increase startup time. You can override this default by
causing the linker to mark your program demand load. A demand-loadable program is
loaded into memory a page at a time, as it is accessed.
Use the +demand_load option to make your program demand loadable, as follows:
$ f90 +demand_load prog.f90
The f90 command passes this option to the linker, which marks the executable program
demand load.
Demand loading allows a program to start up faster because page loading can be spread
across the execution of the program. The disadvantage of demand loading is that it can
degrade performance throughout execution.
Creating shared executables
By default, the linker marks an executable program as shared. A shared executable is
shareable by all processes that use the program. The first process to run the program loads
its code into virtual memory. If the program is already loaded by another process, then a
process shares the code with the other process.
You can override this default with the +noshared option, which causes the linker to mark the
executable as unshared, making the program’s code nonshareable. The following command
line causes the linker to mark prog.f90 as unshared:
$ f90 +noshared prog.f90