Although using f90 with CTT is preferable, you can still use f77 with CTT's Fortran Numerical Library, FNL. This will be illustrated with the use of the mathematical gamma function evaluated at x=5.
The output from a sample terminal session is shown below, followed by a discussion of the steps. This example is run using the Sun Studio 9 compilers; the f77 source file is in gammaTest.f. The cttshell alias and environment variables used below are available if you have made the suggested UNIX configuration changes described elsewhere.
setenv commands in setup files | |
---|---|
CTT_DIR | /opt/vni/CTT6.1 |
LDLIBS | "$LINK_FNL_SMP" |
<100>% cttshell <1>% touch gammaTest.f <2>% make gammaTest f90 -openmp=noopt -ftrap=%none -xtarget=generic -M/opt/vni/CTT6.1/include/solaris -o gammaTest gammaTest.f -R/opt/vni/CTT6.1/lib/lib.solaris -L/opt/vni/CTT6.1/lib/lib.solaris -Bdynamic -limsl -limslsmp -xlic_lib=sunperf -ldl -lnsl -lsocket <3>% ./gammaTest GAMMA( 5.000) = 24.000 <4>% exit <101>%
C----------------------------------------------------------------------- C IMSL Name: GAMMA/DGAMMA (Single/Double precision version) C C Purpose: Evaluate the complete gamma function. C C Usage: GAMMA(X) C C Example 1: C Declare variables INTEGER NOUT REAL GAMMA, VALUE, X EXTERNAL GAMMA, UMACH C Compute X = 5.0 VALUE = GAMMA(X) C Print the results CALL UMACH (2, NOUT) WRITE (NOUT,99999) X, VALUE 99999 FORMAT (' GAMMA(', F6.3, ') = ', F6.3) END
Last modified: May 23, 2005
This page maintained by Dean Nairn
Copyright © University of Delaware, 2005.