Welcome to AE Resources
Converted document Converted document

HOW TO USE NUMERICAL ALGORITHMS GROUP (NAG) FORTRAN COMPILER

The FORTRAN compiler described here is very similar in operation to other compilers. A list of options specific to this compiler are at the end of this document.
  1. The first step is to open Command Prompt (cmd). Command Prompt is found under accessories on the start menu.
  2. Navigate to the directory where the files are stored using the change directory command (’cd’). Consider if the files were in the directory called C:/Users/Ben/Documents/3_Summer_2012/Fortran_tests. The command to go to this folder would be:
    cd users/ben/documents/3_Summer_2012/fortran_tests
    
  3. Next compile the code by typing nagfor  < filename.f95 >  −  < option > 
    figure Step1.JPG
  4. Press Enter
  5. To run the program type the output file’s name in the Command Prompt. This name will depend on the options selected. If no name was entered the output name will be arbitrary, determined by the compiler program(The default is ’a.exe’). Otherwise enter the name used previously.
  6. figure Step2.JPG

Options

-c Compile only do not link
-C= < option >  Most runtime Checking
  • all perform all checks except for -C=undefined
    array Check Array bounds
    bits Check bit intrinsic arguments
    calls check procedure references
    dangling check for dangling pointers
    do check DO loops for zero step values
    none do no checking: this is the default
    present check OPTIONAL references
    pointer Check POINTER references
    recursion Check for invalid recursion
    undefined Check for undefined variables
-double Double size of default INTEGER, REAL, LOGICALand COMPLEX.
-fixed Source files are in fixed form.
-free Source files are in free form.
Next Page →
Next Page →