CSCE 206 Scientific Applications Programming - PowerPoint PPT Presentation

1 / 25
About This Presentation
Title:

CSCE 206 Scientific Applications Programming

Description:

It will at times seem like a course in programming, because we will sometimes ... Stravinsky. There is a lot of code available to look at and use. CSCE 206. 15 ... – PowerPoint PPT presentation

Number of Views:13
Avg rating:3.0/5.0
Slides: 26
Provided by: cse9
Learn more at: http://www.cse.sc.edu
Category:

less

Transcript and Presenter's Notes

Title: CSCE 206 Scientific Applications Programming


1
CSCE 206Scientific Applications Programming
  • This is not a course in programming
  • This is a course in computing
  • We will do a lot of programming
  • It will at times seem like a course in
    programming, because we will sometimes get bogged
    down in details

2
CSCE 206
  • This will at times seem like a course in
    programming, because we will sometimes get bogged
    down in details
  • Try to remember
  • that this is a course in computing
  • that to know computing you must know
    programming
  • that our goal is computing for numerical
    applications

3
Numerical Applications
  • Top 500 list www.top500.org
  • Finding roots of equations
  • Interpolation of functions
  • Curve fitting
  • Numerical differentiation
  • Numerical integration
  • Matrix operations
  • Averages, deviations, moments
  • Differential equations

4
Why Fortran?
  • Why not Matlab? MathCad? Maple? Mathematica?
  • For small applications, these are fine
  • For large applications, they are too slow and
    inflexible
  • Real computing requires a real language

5
Which Fortran?
  • 195x FORTRAN
  • 1962 FORTRAN II
  • 1966 FORTRAN IV (a.k.a. FORTRAN 66)
  • 1977 FORTRAN 77
  • 1990 Fortran 90
  • 1995 Fortran 95
  • 2003 Fortran 2000 a.k.a. Fortran 2k
  • Various other versions have also existed (HPF,
    IBM FORTRAN G, H, )

6
Which Fortran?
  • The big change was to Fortran 90 from FORTRAN 77
  • We will do F90, which is the modern Fortran
  • Differences between F90, F95, and F2K are
    nonexistent at the level of this course
  • Vendors have always enhanced their languages as
    a way of making vendor switching hard
  • We will concentrate on ANSI Standard Fortran 90
  • (ANSI American National Standards Institute)

7
Why Unix?
  • For small jobs, for simple experimentation, you
    should use Matlab, or something similar.
  • The reason for using a real programming language
    is to solve problems too big for desktops.
  • There arent any non-Unix machines on the Top 500
    list (and I dont think there ever have been
    any).
  • Real computing is done on Unix machines.

8
Which Unix?
  • It is almost true that all Unix is alike.
  • Unix
  • Linux
  • Solaris (Sun Microsystems)
  • HPIX (Hewlett-Packard)
  • Irix (Silicon Graphics)
  • UNICOS (Cray Research, Inc.)
  • AIX (IBM)

9
Why Unix?
  • I view different computer operating systems as
    being like different cuisines. Using an Apple is
    like keeping kosher the believers would not live
    any other way, but they cannot eat with members
    of other religions. Using Unix is like preparing
    your own meals from recipes in the Joy of
    Cooking the effort involved initially exceeds
    the palatability of the results, but experience
    eventually brings satisfaction. Using Microsoft
    Windows is like eating at a McDonalds you can
    find one anywhere, and the food will keep you
    going, but it would be sad if there were no other
    restaurant in town.
  • (Gerald Folland, American Math Monthly, March
    2000)

10
Bottom Line
  • We will, therefore, cover
  • computing
  • in the modern (standard) version of Fortran
  • on numerical applications
  • on a standard Unix platform
  • This will be computing done the way its done in
    the major leagues (Los Alamos, NCAR, Livermore,
    aircraft/auto/oil industry)
  • This will (I hope) prepare you to be adaptable to
    Fortran (and other languages) on other platforms
    using other compilers and tools

11
How-to-write-programs Issues
  • The operating system (in this case, Unix)
  • The development environment
  • editor (you are free to choose)
  • we will not use a GUI (graphical user interface)
  • we will use a command line interface
  • we will use a makefile for convenience
  • Compiler to translate source code to an
    executable
  • Libraries of standard routines (math functions,
    etc.)

12
CSE Dept How to Write Programs
  • I dont use Blackboard I do use the CSE web
    server, and almost everything will be on the web
  • look up the CSE secure web page
    https//www.cse.sc.edu
  • CSCE dropbox for submitting your programs
  • CSCE206 group mailing list for broadcast
  • CSCE individual email accounts
  • www.cse.sc.edu
  • www.cse.sc.edu/buell

13
Bonus Points
  • Computing is a human endeavor
  • You should know the human history of how we got
    to where we are
  • In-class bonus points 1 point on the total
    grade
  • Exam bonus points 2 points on the total grade
    per exam

14
Some Thoughts on Programming
  • Lesser artists borrow great artists steal.
  • Stravinsky
  • There is a lot of code available to look at and
    use.

15
From Whom Can You Steal?
  • Yourselfof course, from one program to the next
  • From the textyes
  • From the Internetno
  • From yourselfyes
  • From other reference booksno
  • From yourselfyes
  • From the Internetno
  • There is a program that lets me compare one
    program against another for similarities.

16
The End
17
Chapter 0 (or 1?)
  • Computer organisation and architecture
  • How is the machine put together
  • p17-ComputerComponents.pdf

18
The Program Translation Process
  • Program source code (C, Fortran, Java, )
  • Source is translated by a compiler
  • into object code
  • and then into machine code
  • which forms an executable module

19
Source Code
  • Has symbolic names for things and permits writing
    programs in a way that is understandable by
    people.
  • PROGRAM hello_world
  • IMPLICIT none
  • REAL r,s
  • PRINT , hello, world
  • PRINT , My name is Duncan Buell
  • r 64.0
  • s SQRT(r)
  • PRINT , r is,r,and its square root is,s
  • STOP
  • END PROGRAM hello_world

20
Machine Code
  • Machines dont understand Fortran
  • Computers dont have a single instruction that
    prints a line of output, for example
  • Machine code is the numerical language for the
    specific instructions of the machine
  • one machine code instruction one machine
    operation
  • The compiler (and other language translators)
    turn source code into machine code

21
Object Code
  • Object code is intermediate between source and
    executable
  • We wont deal much with object code, and we wont
    even define it carefully
  • Characteristic of object code
  • the compiler turns your source into object
  • references outside your own source (e.g., math
    libraries) may not be fully turned into machine
    code by the compilerthat happens later

22
The Programming Process
  • Problem analysis and specification
  • Data organisation and algorithm design
  • Coding (programming)
  • Execution and testing
  • Maintenance

23
Political CorrectnessSafe programming
  • Programs have bugs
  • Programs have always had bugs
  • We all do stupid, careless, things
  • Its possible to be careless and still get a
    working program
  • But its more likely that youll get working
    programs if you follow safe programming
    practices
  • And Im going to beating these practices into you
    the entire semester!!!!!

24
Prudent Programming Practices
  • Failure is the norm. Youre going to fail. So
    fail in such a way that you can recover quickly
    and get it right the second time. (John Mashey)
  • A working program that doesnt quite do what is
    desired has some value.
  • A program that would do everything desired, if it
    worked, but doesnt work, has almost no value.
  • Make it right before you make it better.

25
The End
Write a Comment
User Comments (0)
About PowerShow.com