[Beowulf] Teaching Scientific Computation (looking for the perfect text)

Joe Landman landman at scalableinformatics.com
Tue Nov 20 16:47:10 EST 2007

Hi Nathan

Nathan Moore wrote:

> In the past, I figured that with the breadth of topics included in the 
> course, Fortran, specifically the basic, simple, and reliable F77 
> dialect (w/ some F90 conveniences) was the language to teach.  In my own 
> head, my rationale was:

FWIW:  I recently taught a short "Intro to MPI" seminar/course at a 
local university.  I used C.

One of the principal comments back was "thats nice, but we want it in 


> - Most students can grasp the basics of fortran in half a day's reading, 

It is pretty simple (until you open files and want to do any sort of IO).

> so I can spend more class time on science and math (probably because 
> there are no pointers - I think that C is much harder for students and 
> sometimes "seems" less like mathematical syntax than f77)

C has a nasty way of doing exactly what you tell it to do, which oddly 
enough, might not be completely aligned with what you want it to do.

> - "Classical Fortran" is a great text and is readable for self-study (I 
> know of no such text for C/C++)

I would argue that the language itself is a way to express the program, 
and not a means in and of itself.  I would suggest both C and Fortran, 
starting with Fortran, and then switching over to C.  This allows you to 
do a compare and contrast without drawing conclusions.

> - several free compilers exist (g95 seems ok so far)

The gcc 4.2 is pretty good (haven't compared gfortran to g95, last I 
checked, g95 was able to compile more stuff), though more as a teaching 
compiler.  Not sure I want it working on optimizations.  It is ok on 
integer optimizations, but doesn't do as well as other non-free 
compilers for FP opts.

> - Netlib, lapack, and numerical recipes cover the math library adequately
> - F77 is compiled (Perl/python are too slow for an MD/MC sim and I 
> figure that students should know at least on compiled language and one 
> scripting language to be competent)

Perl is a good choice for scripting (I like it better than Python). 
More than once I have destroyed a Python program with careless use of 
spaces.  Indentation based structure (like old F77) is horrible.  F9* 
gets you out of that.

> - MPI is a relatively basic addition to the language (again, no 
> pointers, allocation, or addressing)

F9* has stuff to handle this.  You have more control with C though.

(not flame bait) Fortran is still a very good language for HPC. 
Language wars are largely expenditures of hot-air; what matters is what 
the students will use as professionals.

> After reflection though, I've started to wonder about the wisdom of my 
> choice.  Specifically (like RGB), I love the GSL library, and extending 
> GSL to fortran in an intro class is non-trivial.  Additionally, most 

GSL is nice, though at last look it wasn't parallel/threaded.

> vendors supply "fast" hardware libraries in C (I may be ignorant, but if 
> a student wants to call an AMD ACML fast-math function( 
> http://developer.amd.com/acml.jsp), or write a linear algebra function 
> to run on a graphics card(http://developer.nvidia.com/object/cuda.html 
> <http://developer.nvidia.com/object/cuda.html>), the vendors seem to 
> assume that you'll write the code in C). 

Graphics folks don't generally believe in any other language (well, 
assembly, and I heard rumors of Java, though I have trouble believing 
the last).  ACML isn't too painful to link into fortran, nor is MKL, etc.

> Also, and more relevant, I assume that most employers word-associate 
> "Fortran is to backwards as C is to competence".

As an employer, I would prefer people whom can code, and learn to code, 
regardless of the language.  I had a student complain to me once in an 
HPC class I taught a while ago, that they didn't know C, but they knew 
C++ and could they use that .....

As an employer, I want to see people who can think, adapt, learn.  I 
don't want to see "I know X, and won't ever change".  There are other 
places for such folks.

> So, I'm thinking about reworking the class to favor C, and fearing 3 
> weeks of pointer and addressing hell.  For those of you who teach 

Its actually not that painful.  I was able to walk through it in one 
session, explaining what the symbols mean, how to read them, and then 
showing them in use for a heat diffusion problem in 2D (breaking up a 
large array into panels).

> scientific computation (and also those of you who hire undergrads), I'd 
> be grateful for your thoughts.  One specific question I have is what 
> text covers scientific programming and touches on MPI using the C language.

There are a few, though if you want to focus on the scientific computing 
portion, that is generally different than the language portion.

Sum reductions look the same in all languages.  And they can be done 
incorrectly in all languages :(


> regards,
> Nathan Moore
> -- 
> - - - - - - -   - - - - - - -   - - - - - - -
> Nathan Moore
> Assistant Professor, Physics
> Winona State University
> AIM: nmoorewsu
> - - - - - - -   - - - - - - -   - - - - - - -
Joseph Landman, Ph.D
Founder and CEO
Scalable Informatics LLC,
email: landman at scalableinformatics.com
web  : http://www.scalableinformatics.com
phone: +1 734 786 8423
fax  : +1 866 888 3112
cell : +1 734 612 4615
Beowulf mailing list, Beowulf at beowulf.org
To change your subscription (digest mode or unsubscribe) visit http://www.beowulf.org/mailman/listinfo/beowulf


More information about the Beowulf mailing list