next up previous contents
Next: C and C++ Compilers Up: New User Documentation Center Previous: Reading Email from Fisher

Fortran on the Suns

The Fortran compiler used on SUN workstations is f77. f90 is also available on some machines.

  1. Locate the Fortran on-line manual page. The command to bring up the manual page is:

    man f77 To quit reading, type q .

  2. Compile a program. After typing in your Fortran program, you must use the f77 (Fortran) compiler before your program will run. Type:

    f77 prog1.f New files were created in your directory during the compile process. These files are described below:

    prog1.o | Object file used to create executable.

    a.out | Executable file which is ready to run.

    You may wish to name your executable file prog1. Remove the old executable and compile your program again using this command:

    f77 -o prog1 prog1.f

  3. Learn compile options. There are many other compile options you can use. They are all described in the manual page. Here are just a few:

    f77 -g prog1.f | Will allow debugging on executable.

    f77 -o prog1.f | Will produce a prog1.o without an a.out.

    f77 -lm prog1.f | Will link the /usr/lib/libm.a (math) library to a.out.

    f77 -M prog1.f | Will list the libraries and routines called by prog1.f.

  4. Use the IMSL library routines. Quoting the documentation, ``The IMSL Libraries embody a comprehensive collection of mathematical and statistical FORTRAN subprograms - more than 900 in all.'' For extensive information, examples and function index of IMSL, type

    cd /usr/mtu/imsl.idf | will take you to IMSL directory

    imsl.idf | will fire up the IMSL interactive documentation facility.

    To use IMSL you will need to set two environment variables:

    setenv LD_LIBRARY_PATH=/usr/mtu/imsl

    setenv LM_LICENSE_FILE=/usr/mtu/imsl/bin/license.dat

    and link IMSL to your program:

    f77 filename.f -limslib | will link /usr/mtu/imsl/libimsl.sa.0.1

  5. Using data and output files. To execute your program and send it data, use the ``less than'' arrow with the data file name:

    prog1 < data1 To execute your program and save the output to a file, use the ``greater than'' arrow:

    prog1 > output1 If you are using both data and output files, the correct form would be:

    prog1 < data1 > output1


next up previous contents
Next: C and C++ Compilers Up: New User Documentation Center Previous: Reading Email from Fisher

Darla K. Kuras
Thu Jul 23 11:09:59 EDT 1998