1 / 25

CSCE 206 Scientific Applications Programming

CSCE 206 Scientific 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…. CSCE 206.

mvilla
Download Presentation

CSCE 206 Scientific Applications Programming

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  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 aren’t any non-Unix machines on the Top 500 list (and I don’t 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 McDonald’s; 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 it’s 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 operatingsystem (in this case, Unix) The developmentenvironment • 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 don’t use Blackboard; I do use the CSE web server, and almosteverything 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? Yourself—of course, from one program to the next From the text—yes From the Internet—no From yourself—yes From other reference books—no From yourself—yes From the Internet—no 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 sourcecode (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 don’t understand Fortran Computers don’t 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 won’t deal much with object code, and we won’t 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 compiler—that happens later

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

  23. Political Correctness—“Safe” programming Programs have bugs Programs have always had bugs We all do stupid, careless, things It’s possible to be careless and still get a working program But it’s more likely that you’ll get working programs if you follow “safe” programming practices And I’m going to beating these practices into you the entire semester!!!!!

  24. Prudent Programming Practices “Failure is the norm. You’re 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 doesn’t quite do what is desired has some value. A program that would do everything desired, if it worked, but doesn’t work, has almost no value. “Make it right before you make it better.”

  25. The End

More Related