In this appendix we give a very short description of four of the most common computer environments, namely UNIX (including the Cray dialect UNICOS), MS-DOS and VAX/VMS. Other common environments are the IBM big computer operating systems MVS and VM, and the new PC operating systems Windows 3.1, Windows 95, Windows NT, and OS/2, and the Apple Macintosh.
When it was time at Linköping university to replace the old DEC-20 computers running the excellent TOPS operating system from Digital Equipment Corporation, the common operating system UNIX was the natural choice for the new operating system. In spite of the fact that UNIX is not one standard (but rather a lot of conflicting standards) it has become an informal world standard for serious computing. It was developed by a few persons at the American telephone company AT&T, to which all UNIX-users had to pay a license fee. This fee was however lower if you did not call it UNIX, Digital had therefore ULTRIX and Cray still has UNICOS. In the following we use the word UNIX also for the dialects.
UNIX is an operating system where the usual user can manage with very commands, while the experienced user has a very powerful environment at his/her disposal. It is important for the beginner to recognize the fact that UNIX distinguishes between lower case and UPPER CASE. Most other operating systems do not distinguish between them, but UNIX does! The normal way is to use lower case for almost everything in UNIX.
The commands in UNIX usually consists of only 2 or 3 characters. In order to list the names of the files in the present directory you use the command ls, or the more powerful ls -lFa, often abbreviated lls. Abbreviations are defined in a suitable login file (there are several of these, depending on which sell(s) you are running). Their names start with a dot
alias lls 'ls -lFa'
You can find the presently set aliases with giving the very simple command alias.
You can list the contents of a file with the command cat followed by the file name. It is however often better with large files to use more, with which you can go forward and backward in the file. Space gives one screen page forwards, b gives one screen page backwards, and q gives exit. You can copy files with cp old_file new_file, move or change the name with mv old_name new_name, and remove a file with rm name. You move around in the file structure with the command cd area.
You can edit the file with a system specific editor, with the UNIX standard-editors ex or vi or with the well known emacs.
For Fortran 77 programs the file name is supposed to end with .f, for example prog.f. If you try to compile a program with the filename prog.txt you may get an error message about "bad file magic number". For Fortran 90 the program file name should end with .f90, if you use the new free form. If you use the old fix form the ending .f is still valid.
Remark. The name of a Fortran program unit can end with some other characters, like .for. This is implementation dependent.
You compile with the command f77 or f90, respectively, followed with the file name, for example f77 prog.f. A successful compilation creates an executable program with the name a.out, and the program is executed if you write that name.
Help is available under UNIX in the form of a manual command, man. We suggest you try man f77 or man f90 in order to study your Fortran compilers special features. Sometimes you can use -C to obtain check of indices during execution, -u to force that all variables have to be declared, -vms to obtain some features from DEC VAX/VMS.
Communication with other systems is obtained with the commands telnet or rlogin, with which you logically move to another system, and with ftp, which is used for file transfer
You log out from UNIX with exit, from some auxiliary systems with quit. In order to log out from a workstation running Windows or W-Windows you also usually have to log out also with the mouse.
The operating system on the Cray is called UNICOS and is a variant of UNIX. In spite of the fact that it nowadays is possible to use the Cray as any other UNIX computer it is still very common to edit the program and do some post processing on a more conventional UNIX computer.
The result of an execution on the Cray quite often has normal lineprinter format, that is 132 positions wide.
Now when it is possible to run interactively on our Cray you first transfer the files with the command ftp cray.nsc.liu.se and then move to the Cray for compilation and execution with the command telnet cray.nsc.liu.se. Editing on the Cray is easiest via X-windows on the work station.
Tip 1. Compile first your Fortran program on the work station in order to get rid of the minor errors in a simple and efficient way!
Tip 2. Use the script below as a starting point. QSUB-r gives the name of the job, in user you are supposed to give your user identity on the Cray. You give the primary memory requirement in million words with QSUB-lM, hpm gives a measurement of how efficient the hardware is used (hardware performance monitor) while ja is for job accounting.
As a test we use a simple program EPSILON to calculate the machine or rounding constant.
$ cat epsilon.f program epsilon real a, b, tred tred = 1.0/3.0 a = 4.0*tred - 1.0 b = 1.0-3.0*a b = 0.5 * b write(*,*) ' Fortran: my = ', b end $ f90 epsilon.f $ ./a.out ! Note the necessity of ./ Fortran: my = 7.105427357601001E-15
This method is most suitable for tests and very small jobs.
All HTML-links and all the comments below have been added manually after the execution.
$ cat module.job # user=x_nscbi ! Username # QSUB-r bosse ! Job name # QSUB-lT 50 ! Maximal CPU time in seconds # QSUB-lM 4Mw ! Maximal primary memory # QSUB-eo ja ! Prepare job accounting set -x ! Echo all commands cd $TMP ! Go to the temporary area f90 -r 6 ~/epsilon.f ! Compile with complete listing cat epsilon.lst ! Print the compilation list hpm -g 0 ./a.out ! Measure the program during execution ja -s ! Report $ qsub modul.job ! Send the job for execution nqs-181 qsub: INFO Request <94359.sn1037>: Submitted to queue
by . $ ustat ! Look on the present queue NQS_ID JOB_NAME QUEUE USER STAT PRI CPU_TIME MAX_CPU SIZE MAX_SIZE 94359 bosse t200_m8 x_nscbi R4 22 0 50 984kw 4mw 94184 phos-3 tx_m24 x_nscler R5 N 32 76259 100000 24210kw 24mw 94325 dimesi4 tx_m24 x_nscec R5 N 32 5385 600000 15946kw 16mw 94337 rev46a tx_m24 x_nsctj R6 N 32 2012 100000 8163kw 8mw 94116 bdrc3 tx_mx x_nfrsll R5 N 36 135151 500000 40439kw 50mw $ ls bo* ! Find the complete name of the output file bosse.o94359 $ cat bosse.o94359 ! Print the output file (result) This is a private computer facility. Access for any reason must be specifically authorized by the owner. Unless you are so authorized, your continued access and any other use may expose you to criminal and/or civil proceedings. Information about NSC and CRAY is available at http://www.nsc.liu.se/ news: CrayLibs20.news PrgEnv.news CC20.news CrayTools20.news + cd /nsc/tmp/tmpdir.020275a ! This is the echo of cd $TMP + f90 -r 6 /home/nsc/x_nscbi/epsilon.f + cat epsilon.lst ! Compilation list ! This becomes very long and is abbreviated here! 1 program epsilon 2 real a, b, tred 3 tred = 1.0/3.0 4 a = 4.0*tred - 1.0 5 b = 1.0-3.0*a 6 b = 0.5 * b 7 write(*,*) ' Fortran: my = ', b 8 end 3 Local Variables (11 references, 8 Uses) A B TRED + hpm -g 0 ./a.out ! Execution Fortran: my = 7.105427357601001E-15 ! Result ! Statistics Group 0: CPU seconds : 0.00 CP executing : 213419 Million inst/sec (MIPS) : 38.98 Instructions : 49916 Avg. clock periods/inst : 4.28 % CP holding issue : 49.01 CP holding issue : 104604 Inst.buffer fetches/sec : 0.70M Inst.buf. fetches: 902 Floating adds/sec : 0.02M F.P. adds : 23 Floating multiplies/sec : 0.03M F.P. multiplies : 43 Floating reciprocal/sec : 0.00M F.P. reciprocals : 0 I/O mem. references/sec : 0.00M I/O references : 0 CPU mem. references/sec : 28.37M CPU references : 36332 Floating ops/CPU second : 0.05M + ja -s Job Accounting - Summary Report ! Report =============================== Job Accounting File Name : /tmp/nqs.+++++0M1M/.jacct3104 Operating System : sn1037 sn1037 220.127.116.11 ope.10 CRAY Y-MP User Name (ID) : x_nscbi (789) Group Name (ID) : g90027 (527) Account Name (ID) : A-00000 (0) Job Name (ID) : bosse (3104) Report Starts : 09/24/96 09:51:20 Report Ends : 09/24/96 09:51:28 Elapsed Time : 8 Seconds User CPU Time : 1.1764 Seconds System CPU Time : 0.4904 Seconds I/O Wait Time (Locked) : 1.6376 Seconds I/O Wait Time (Unlocked) : 4.3639 Seconds CPU Time Memory Integral : 0.6067 Mword-seconds SDS Time Memory Integral : 0.0000 Mword-seconds I/O Wait Time Memory Integral : 0.9573 Mword-seconds Data Transferred : 1.2468 MWords Maximum memory used : 1.0830 MWords Logical I/O Requests : 374 Physical I/O Requests : 323 Number of Commands : 16 Billing Units : 0.0708
Information that a job has terminated can be obtained with email using the instructions in the Swedish Newsletter 114, section 6.
This method is suitable for small jobs.
For information about how to use the Network Queuing System and the Network Queuing Environment the reader is referred to NSC. Some information is also available in our Newsletters in Swedish, for example 101 (section 4, personal installation, and section 5, test) and 103 (section 3, user instructions). Information that a job has executed can be obtained with email according to the instructions in Newsletter 114.
You can of course also go directly to the information on the Network Queuing Environment from Cray Research.
Large jobs should be run in this way.
MS-DOS does not distinguish between lower case and UPPER CASE.
The method to compile and run Fortran programs varies with the compiler manufacturer. Our main experience is with Fortran 90 from NAG.
With the NAG system the compilation command is FTN90 and the source code is supposed to be in *.F90 for the new free form and *.FOR for the old fix form. In order to obtain immediate execution you add /LGO.
C:\> ftn90 program.f90 /lgo
If the program has some program units in different files you can compile these parts separately, for example PART1.F90 and PART2.F90 as
C:\> ftn90 part1.f90 C:\> ftn90 part2.f90
and get the two object files PART1.OBJ and PART2.OBJ. These can be linked with LINK77 to create the executable program WHOLE.EXE.
C:\> LINK77 $LOAD PART1 $LOAD PART2 $FILE WHOLE.EXE C:\> C:\> WHOLE
The symbol $ above is generated automatically by the linker LINK77, which also is a NAG-product. It is included in the purchase of the compiler, together with the auxiliary system DBOS.
Also at the execution of an executable program created with FTN90 you must have DBOS active. The system also includes an emulator for floating-point calculations (only used if an actual floating-point processor is missing, as in the Intel SX 486).
The Microsoft FORTRAN version 5.1 is used in the following way. We assume that the program is in the file PROGRAM.FOR and compile with
C:\> FL /Fs PROGRAM.FOR
This compilation creates two files, one program listing PROGRAM.LST (with the possible program errors, which are also shown on the screen) and at a successful compilation also an executable program with the name PROGRAM.EXE.
The Microsoft FORTRAN version 5.1 is also discussed in the book by L John Ribar, "Fortran Programming for Windows".
VAX/VMS has since its introduction in 1978 been a very popular operating system for Digital Equipments computers named VAX. The operating system is developed in the direction of UNIX, the present version is also available for Digital's Alpha-system. For this the Digital Fortran 90 is available.
Files may be created and edited with the VAX standard editor EDT or TPU (which both use special keys, including the numeric key pad) or the usual editor EMACS or the simplified version AMIS.
A suitable name for a program file is PROGRAM.FOR.
The program is supposed to be compiled, linked, and executed. This is normally done in three steps, first compilation with the command
followed by linking of PROGRAM.OBJ with the command
and finally execution of PROGRAM.EXE with
The above assumes Fortran 77, since I do not have access to any VAX with Fortran 90. Please note that neither VAX/VMS nor MS-DOS distinguish between lower and upper case.