To compile a program for parallel execution using kapf
, use the following commands depending on your version of Digital
UNIX as follows:
kapf -conc -cmp=myprog_mp.f myprog.f f77 myprog_mp.f -fast -tune host -automatic -call_shared \ -lkmp_osf -threads
kapf -conc -cmp=myprog_mp.f myprog.f f77 myprog_mp.f -fast -tune host -automatic -call_shared \ -lkmp_osfp10 -pthread
An explanation of the compiler and linker switches follows:
-automatic
- tells the compiler to allocate
local variables on the run-time stack.
-conc
- tells KAP to restructure source code
for parallel processing.
-cmp
- causes KAP to save the optimized
source program under the file name of your choice. The
kapf
default is to name the optimized source
file_name.cmp
. Because the Fortran compiler
will not process a file with the default extension of
.cmp
, you must override the default by using
-cmp
to rename the optimized source file_
name.cmp.f
.
-fast
- tells the compiler to optimize for
speed and to set the optimization level to -O4
. If
you override the default and set the compiler optimization level
to -O5
, you must also set the following KAP and
compiler switches:
-unroll=1
- KAP switch
-notransform_loops
- Digital Fortran
compiler switch that turns off the compiler's loop transform
capabilities
See Section 4.5.21 for more information
about the -unroll
switch.
-lkmp_osf
- tells the linker to use the KAP
parallel processing library for Digital UNIX Version 3.2. The
parallel processing library provides an interface to DECthreads.
See Section 3.1 for more information.
-lkmp_osfp10
- tells the linker to use the
KAP parallel processing library for Digital UNIX Version 4.0. The
parallel processing library provides an interface to DECthreads.
See Section 3.1 for more information.
-call_shared
- tells the linker to link
against shared libraries. Digital recommends that you use
-call_shared
; however, in the case where you want
to link your application with archive libraries, refer to Section 3.5.
-pthread
- tells the linker to use
threadsafe versions of libraries, where they exist, and to
include Digital UNIX Version 4.0 libpthread
when
linking the program. See Section 3.1 for
more information.
-threads
- tells the linker to use
threadsafe versions of libraries, where they exist, and to
include Digital UNIX Version 3.2 libpthreads
when
linking the program. See Section 3.1 for
more information.
-tune host
- tells the compiler to optimize
for the architecture of the host processor. Note that the
Digital Fortran -tune host
switch and the KAP
Fortran -tune
switch work independently and perform
different optimizations. For information about the KAP Fortran
-tune
switch, see Section 4.1.7.
kapf
to process a file, you must set the Digital Fortran compiler
and linker switches appropriately. For this reason, Digital
recommends that you use kf77
whenever possible,
as kf77
automatically sets the compiler and linker
switches correctly.