The Numerical Algorithms Group Ltd Wilkinson House Jordan Hill Road Oxford OX2 8DR firstname.lastname@example.org Tel: +44 1865 511245 Fax: +44 1865 310139NAG offers a Fortran 95 system which behaves as a compiler but in reality translates to C (except for the PC version). The compiler is now in version 4.0 for both UNIX and MS-DOS. Both work well and include extended error checking both under compilation and execution. For early experiences please see the article "A First Encounter With F90" by Michael Metcalf in Fortran Forum, vol. 11, No. 1, pp. 24-32, March 1992. CERN had at that time a total of 80 000 code lines working with NAG's Fortran 90 compiler, version 1.1. A good service is obtained from the NAG Response Centre using electronic mail. The system is available for many systems.
Link to NAGWare Fortran 90/95 Compilers.
You run Fortran 90/95 in about the same way as you run Fortran 77. The usual commands are, if the source code code1.f90 is in the new free form and source code code2.f is in the old fixed form.
% f95 code1.f90 code2.fand if you have a complete program it can be given an execution name.
% f95 -o program program.f90Using MS-DOS the compilation command is FTN90 and the source code is *.F90 for new free form and *.FOR for old fixed form. In order to get immediate execution you add /LGO as below.
FTN90 PROGRAM.F90 /LGOWhen you have the program in more than one file you have to first compile the various parts separately, and then link with the LINK77 command and obtain an executable program. We now show how to deal with the two program files PART1.F90 and PART2.FOR and creating a ready to run program WHOLE.EXE.
FTN90 PART1.F90 FTN90 PART2.FOR LINK77 $LOAD PART1 $LOAD PART2 $FILE WHOLE.EXEThe symbol $ above is created automatically by the system. For additional information about f90 under UNIX we recommend the manual command
% man f90I here list the most important switches to the compilation command
-c compilation only (no linking) -C index control -fixed the old form of the source code -free the new form of the source code -f77 calling convention consistent with the UNIX f77 -g generates information for debugging -Ipathname Fortran 90 looks automatically for modules in the present directory, in directories in the I-list and in /usr/local/lib/f90 -l linking of a library -Ldir Add dir to the list of directories for library routines -o naming the output file -pg generating execution profile -S produces source code in the language C -v give comment about how the compilation is proceeding -version gives the compiler's version number -w suppresses warnings
f90 -I/example/modules program.f90 -lnag -L/examples/libraries
Please note that NAG has somewhat changed the system parameters in Version 2.1.
As you see NAG uses the digits 1, 2, and 3 for the KIND numbers. In order to improve the portability NAG has introduced an additional compiler switch -kind. If you use -kind=byte you will obtain the number of bytes as the KIND number, if you do not use this switch or use -kind=sequential you will use the NAG convention.
LOGICAL Default byte word Before release 2.1 KIND number = 2 1 2 From release 2.1 KIND number = 3 1 3 INTEGER Default int8 int16 int32 KIND number = 3 1 2 3 digits = 31 7 15 31 radix = 2 2 2 2 range = 9 2 4 9 huge = 2147483647 127 32767 2147483647 bit_size = 32 8 16 32 REAL Default single double KIND number = 1 1 2 digits = 24 24 53 maxexponent = 128 128 1024 minexponent = -125 -125 -1021 precision = 6 6 15 radix = 2 2 2 range = 37 37 307 epsilon = 0.11920929e-06 0.11920929e-06 0.2224460e-15 tiny = 0.11754944E-37 0.11754944E-37 0.22250739-307 huge = 0.34028235E+39 0.34028235E+39 0.17976931+309 COMPLEX Default single double KIND number = 1 1 2 precision = 6 6 15 range = 37 37 307Back to Appendix 6