fort ran compiling

Upload: varaprasadpg

Post on 10-Apr-2018

219 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/8/2019 Fort Ran Compiling

    1/15

    Introduction to Fortran

    and Fortran Compiling

  • 8/8/2019 Fort Ran Compiling

    2/15

    Outline

    Surfing www.mcsr.olemiss.edu website

    Logging into the system via ssh

    B

    asic Structure and Syntaxo

    fF

    ortran A quick glance on PICO editor

    More detailed look on compilers andcompiling commands

    Application of Fortran Compiling

  • 8/8/2019 Fort Ran Compiling

    3/15

    Logging into the system using ssh Logging into the system from Windows:

    Start the secure shell client:Start->Programs->SSH Secure Shell->Secure Shell Client

    Connect to willow:From the secure shell window, click Quick Connect.Then, from the Connect to Remote Host pop-up window, enter:Hostname : HostName

    User Name: UserNameClick Connect.

    Logging into the system from Unix: Start the Terminal:

    Finder Utilities Terminal Type the following command:

    ssh UserName@HostNameEnter your password

    If you are a windows user and you want to download ssh;Go to IT Helpdesk @http://www.olemiss.edu/helpdesk/resources.html#software and click onthe SSH Secure Shell 3.1 link.

    If you are a Unix user, ssh will come with the operating system

  • 8/8/2019 Fort Ran Compiling

    4/15

    Simple Fortran Program

    c This program adds two numbers and displays the result

    program add

    double precision a,b,c

    write(*,*) 'Input two numbers (include a decimal point)'read (*,*) a,b

    c=a+b

    write (*,*) 'The sum of the numbers you entered is', c

    stop

    end

  • 8/8/2019 Fort Ran Compiling

    5/15

    The PICO Editor

    General Command Write editor contents to a file [Ctrl] o

    Save the file and exit pico [Ctrl] x

    Spell Check [Ctrl] t

    Justify the text [Ctrl] j

    Moving around in your file Move one character to the right [Ctrl] for right arrow key

    Move one character to the left [Ctrl] b or left arrow key

    Move up one line [Ctrl] p or up arrow key

    Move down one line [Ctrl] n or down arrow key

  • 8/8/2019 Fort Ran Compiling

    6/15

    More detailed look into Compilers and

    Compiling commands

    Fortran Compilers at UM/MCSR: MIPSPro Fortran Compilers, version 7.4, on sweetgum

    Portland Group and MPICH Fortran compilers on

    mimosa Intel Fortran Compilers(7.1, 8.0 and 9.0) on redwood

    GUI g77 on willow

    Suns Forte f90 on willow

  • 8/8/2019 Fort Ran Compiling

    7/15

    Sweetgum

    MIPSPro Fortran Compilers, version 7.4

    To compile with f77 on sweetgum, enter:

    f77 filename.for

    To compile with f90 on sweetgum, enter: f90 filename.for

  • 8/8/2019 Fort Ran Compiling

    8/15

    Mimosa

    Portland Group and MPICH Fortran compilers

    To compile with the MPICH Fortran compilers, enter:

    /usr/local/apps/pgi-5.2/linux86/5.2/bin/pgf77 filename.for

    To compile with the PGI SDK compilers, enter:

    /usr/local/apps/pgi-6.1/linux86/6.1/bin/pgf90 filename.for

  • 8/8/2019 Fort Ran Compiling

    9/15

    Redwood

    Intel Fortran Compilers(7.1, 8.0 and 9.0)

    Before using the Fortran Compiler on redwood, you mustfirst load the appropriate Intel compiler module.

    Then, to compile:

    ifc filename.for if using the 7.1 compiler

    ifort filename.for if using the 8.0 or 9.0 compilers

  • 8/8/2019 Fort Ran Compiling

    10/15

    Loading the appropriate Intel Compiler

    Module Several versions/builds of Intel compilers are available on redwood. To

    compile, you must first pick which compiler version module you want toload, then load it. Before you can use the module command, you mustsource the correct setup file for your shell. . /usr/share/modules/init/sh (if using ssh) (There should be a space between .

    and /opt)

    Then you use the module command: module list (to see if any other versions of compiler modules are loaded) module purge (to unload any other versions of compiler modules) module list (to verify that other versions were successfully unloaded) module avail (to see what versions of compiler modules are available to load)

    For example, to load the latest 9.1 version of the F Compilers: module load f91 module list

    These are the namesof the m

    odules and the c

    ompiler versi

    ons theycorrespond to:

    intel-compilers.7.1.037 for fortran 7.1 intel-compilers.8.0.042 for fortran 8.0 intel-compilers.8.0.046 for fortran 8.0 intel-compilers.9.0.027 for fortran 9.0 intel-compilers.9.1.046 for fortran 9.1

  • 8/8/2019 Fort Ran Compiling

    11/15

    Willow

    Suns Forte f90 To compile with f90, enter:

    f90 filename.for

    If there are no compilation errors this creates an executable filecalled a.out. To execute the Fortran program, enter: ./a.out.

    GUI g77

    To compile with g77, enter: g77 filename.for

    If there are no compilation errors this creates an executable filecalled a.out. To execute the Fortran program, enter: ./a.out.

  • 8/8/2019 Fort Ran Compiling

    12/15

    More about Compiling Commands

    If there are no compilation errors, thepreviously mentioned Fortran Commandscreate an executable file called a.out. To

    execute the Fortran program, enter:./a.out.

    To create an executable file with anotherfilename, use the o flag, for example:

    f90 o

    exefilename filename.for

    For more information about Fortrancompilers, Go to: www.mcsr.olemiss.edu

    SoftwareFortran

  • 8/8/2019 Fort Ran Compiling

    13/15

    How to run a compiled files

    The compiling commands createan executable file known as

    a.out unless specified otherwise.

    To execute your program, type:

    ./a.out and press Enter.

  • 8/8/2019 Fort Ran Compiling

    14/15

    MCSRFortran Compilers

    MCSR's Fortran compilers and platformsare available for instructional or researchuse for all students, faculty, and staffofM

    ississippi's eight public universities.Users should decide which compiler is bestsuited for their application. Compilers onSUN are for fast jobs with a quick turnaround, while compilers on sweetgum andmagnolia are designed for larger, morecomputationally intensive jobs.

  • 8/8/2019 Fort Ran Compiling

    15/15

    MCSRAccounts

    MCSR is pleased to provide free computeraccounts on redwood, sweetgum, and mimosa forany student, faculty, or research staff member atany ofMississippi's 8 publicly funded universities.

    If you can't access an existing account, please e-mail [email protected] or call one of theconsultants at 662-915-7206. You may request apassword reset from the MCSR Online AccountManager.