[net.physics] Unix for physicists

anand@utastro.UUCP (Anand Sivaramakrishnan) (06/11/84)

I am a dynamicist by nature (so I'm a theoretical physicist/
stat. mechanician or whatever under my astronomer's clothing)
here at U. of Texas, and we have a vax 11/780 under Berkely's
UNIX (sob! sniffle!).

My recommendation is DON'T GET UNIX!!!!!!!!!!!!!!!

I have found that an awful lot of people waste an awful lot
of time trying to fix or get around  bugs in the compiler (FORTRAN).
A lot of scientists still use FORTRAN, so a shaky, unreliable
f77 compiler is a severe drawback, and I believe a scientific, heavily
arithmetically oriented department cannot afford to base its computation
on UNIX's FORTRAN.

Here on our VAX even absolutely standard fortran 77 can foul up in  
compilation or running, and diagnostics are 
terrible (there is a symbolic debugger that doesn't work
with the updated version of fortran 77 but does with
the older version of f77 - but this f77 does not handle character
data with equanimity) . Even the 4.2BSD f77 compiler gets
ruffled by simple integer and character arithmetic... it
seems to overwrite chunks of memory and pull out random
values for previously well-behaved variables. Things that
look like arcane optimization bugs appear ROUTINELY
when we compile with NO OPTIMIZATION.


I have used VMS, and I can see that UNIX is so much more fun
to use, but I think that the pros of unix, for a math/phys/astron
department, are heavily outweighed by its cons.

That's my 2 cents.... 

elt@astrovax.UUCP (Ed Turner) (06/12/84)

Our site has also suffered heavily from the unspeakably disgraceful f77
compiler supplied with Berkeley UNIX 4.2.  It would be difficult to 
adequately describe how bad this compiler is or how treacherous some of
the bugs uncovered here are.  Nevertheless, I am loath to give up (or advise
others to give up) the advantages of UNIX just to get a decent FORTRAN
compiler.

The best solution, in my opinion, is to switch to C thus getting a good
compiler and a superior language; to the extent that the new f77 compiler
motivates people to do this, it may be a good thing.  Incidentally, the
advantage to a physical scientist of a computer language superior to
FORTRAN is analogus to the advantages of a superior mathematical notation.
It allows one to do calculations which are more complex, reliable, 
transparent, and flexible with a given amount of effort.  Many object to
having to learn a new language, but few would try to do General Relativity
with scalar calculus to avoid learning tensor calculus, to take a rather
extreme comparison.

Of course, switching to C cannot be the whole solution given the existence
of enormous amounts of useful FORTRAN code, portability requirements, and
the fact that some people simply won't switch.  There must be a substantial
amount of money to be made by producing a first class FORTRAN compiler that
runs under 4.2.  Surely someone is working on this.  Does anyone know
anything about this?  Please let me know.

Ed Turner
astrovax!elt

carlc@teklabs.UUCP (06/13/84)

> The best solution, in my opinion, is to switch to C thus getting a good
> compiler and a superior language; to the extent that the new f77 compiler
> motivates people to do this, it may be a good thing.  Incidentally, the
> advantage to a physical scientist of a computer language superior to
> FORTRAN is analogus to the advantages of a superior mathematical notation.

I agree that C is superior in many respects to Fortran.  As to it being
a "superior notation" for scientific programming -- well, maybe.  Certainly,
pointers are nice and its good to have other data structures besides
the array.  But Fortran has some things going for it.  (First, a caveat:
I am not much of a C programmer.  There may be useful things in C of which
I'm unaware.  Please inform rather than insult me if I'm wrong.)

1) complex data type.  This is very handy in many physical problems,
especially when dealing with wave phenomena, Fourier transforms, and such.
Especially in speed-critical applications, I have found that the CEXP
funcion is useful for getting both the sine and cosine of the same
argument without making two function calls.

2) A large number of available subroutine packages for scientific
applications, e.g. the IMSL library.  I have never engaged in a major
programming effort which didn't make use of one or another subroutine package.
There are probably ways to link C code to these packages, but I expect
that portability suffers as a result.

3) Variable dimension arrays.  It appears to me that C requires constant
dimensions in array declarations.  This limits flexibility in
utilizing storage space, especially in simulators for solving differential
equations.  Fortran has an extensive set of rules (not all of which make
sense to me) about how subroutines may structure their dummy arrays.
C just seems to say "here's a pointer to the beginning of the array,
do the rest yourself."  If you want variable dimensions, or variable
numbers of dimensions, you must do subscript calculations yourself.

The main point is that Fortran was written for scientific programming.
C was written for fun.   UNIX(tm) in general emphasizes text-processing
applications over number-crunching applications.  (But who'd want
to number-crunch on an overloaded VAX, anyway? -) ) Rather than hop on
the C/UNIX bandwagon, why doesn't some erstwhile group of scientists
and programmers go to work on creating a modern language for scientific
applications?  Fortran-88?  If Fortran could be weaned from its historic
dependence on punched cards and its fear of blanks, and given a wider
variety of data strucures, it could remain an extremely valuable tool
for scientists.  Perhaps a Ratfor-type preprocessing scheme could
achieve some of these ends while maintaining compatibility with
Fortran-77.

nessus@mit-eddie.UUCP (Doug Alan) (06/14/84)

>	From: anand@utastro.UUCP

>	I believe a scientific, heavily arithmetically oriented
>	department cannot afford to base its computation on UNIX's
>	FORTRAN.

I believe that society cannot afford to base any of its computation on
ANY Fortran.
-- 
				-Doug Alan
				 mit-eddie!nessus
				 Nessus@MIT-MC

				"What does 'I' mean"?

 

sherouse@unc.UUCP (06/14/84)

I really {think|hope} that Modula-2 is what {we|you|I}
{am|are} looking for.

I have grown tremendously intolerant of FORTRAN in the last
few years for it's come-hither-and-write-spaghetti attitude.
FORTRAN-77 is just a band-aid.

Pascal is wonderful for things that can be done in one thought
but a nightmare for large system development - even in it's
extended state (a tip of the hat to Oregon Software).  Nevertheless
it *does* know about trig functions and the like and doesn't
insist on a lot of casting to do it.

C is fun.  It is also an invitation to disaster for scientists
who program casually.  It is my experience that they don't
*want* to know about pointers and the like.  And the math library
is nothing if not a nuisance.

Don't talk to me about ADA.

Modula is the great hope for the future.  It has all of Pascal's
wonderful traits (Spend six months in a scientific software house
modifying code from 1966 and you too will scream for STRUCTURE.)
without it's brain damage vis-a-vis the more exotic data manipulations
we all like to leave for posterity.  It cajoles but does not cripple.
I hope.  You see, I haven't actually used it yet.  We are however
on DECWRL's list.  No pressure, guys.

All this applies to new development of course.  If you live in
the shadow of decades of FORTRAN, heaven help you and pass the
Parmesan.

So, there's my two cents.  What've we got now, $1.50?


<< The views expressed are my own and are thus indistinguishable from >>
<<                          absolute truth.                           >>

George W. Sherouse
Associate Physicist
Division of Radiation Therapy
North Carolina Memorial Hospital
Chapel Hill, NC   27514

(919) 966-1101

<decvax!mcnc!unc!godot!sherouse>

dub@pur-phy.UUCP (Dwight U. Bartholomew) (06/14/84)

  Instead of using f77 why don't you use nice and simple f4p.

mwm@ea.UUCP (06/15/84)

#R:utastro:-9000:ea:9900001:000:2054
ea!mwm    Jun 14 16:51:00 1984

/***** ea:net.physics / astrovax!elt /  4:20 pm  Jun 12, 1984 */
The best solution, in my opinion, is to switch to C thus getting a good
compiler and a superior language;

Ed Turner
astrovax!elt
/* ---------- */

Switching to C for numerical calculations is the single *worst* thing I
could do. I'd rather use assembler. Not because I hate C, mind you, but
because C does two things that utterly ruin it for floating-point intensive
computations:

1) All floating point arithmetic in C is done in double precision.
	Whether you want it or not, and no matter how you declared it.
	Can you really afford to have the computation time of your
	code run twice as long as it used to?

2) C insists on being able to rearrange expressions, no matter how you
	parenthesize them. Hence, your (carefully arranged to avoid
	catastrophic subtraction) "(a - b) + c" could get compiled to
	"(a + c) - b", thus giving you spurious zeros that you wrote the
	code to avoid. Right on par with the interlemon giving
	2 ^ 16 * 1 = 0.

In addition, I would be surprised if *any* compiler using the pcc back end
could generate code that runs as fast as the code generated by the VMS
FORTRAN compiler.

I already sent mail on this, but running VMS in a number-crunching shop
(engineers, physicists, etc) has several advantages over Unix.  An on-line
help system. A good FORTRAN compiler. Manager-level control of the
environment that rivals the users control of the Unix environment.  Running
a VMS shop for that group is *much* easier than running a Unix shop for
them, especially if you don't have source to Unix.

Before you start asking what I'm doing on the net, I recommended to our
management that we run VMS. They chose Unix because a binary for it is
cheaper than a binary for VMS and a FORTRAN compiler. Ninety percent of the
trouble I've had running this system wouldn't have happened under VMS.  Of
course, I wouldn't have gotten all the neat toys to play with that come
with/for Unix (FP, Icon, CLU, Franz Lisp, etc.). I won some, me and my boss
lost some.

	<mike

gwyn@brl-vgr.ARPA (Doug Gwyn ) (06/17/84)

Indeed the 4.2BSD f77 is bad.  So is the UNIX System V Release 1 f77,
although its worst problems were supposedly fixed in Release 1.1 (and
therefore also in Release 2).  4.2BSD sites can try to obtain the new
f77 from Berkeley (rotsa ruck) or wait for the Release 2 edition of the
BRL UNIX System V emulation.

Anyone who writes new code in ordinary Fortran when C is available
should be made to justify the practice (the two reasons I can think
of are built-in complex operations and better support for arrays).
I too started out as a Fortran physicist, but I learned better..

gwyn@brl-vgr.ARPA (Doug Gwyn ) (06/17/84)

As long as we're on this topic, I'm curious about the reasons for
physicists & engineers writing their own code, especially if they
are not also software professionals.  Seems like one would be better
off describing the task (solution method included) to a professional
programmer.  I have seen a lot of (non-software) professional time
burned up with very poor relative results.

mwm@ea.UUCP (06/18/84)

#R:utastro:-9000:ea:9900002:000:477
ea!mwm    Jun 18 00:42:00 1984

/***** ea:net.physics / mit-eddi!nessus / 12:46 am  Jun 14, 1984 */
I believe that society cannot afford to base any of its computation on
ANY Fortran.
-- 
				-Doug Alan
/* ---------- */

What would you have us use? Second question: how do I convince the
engineers around here (we do work that peoples *lives* depend on) to change
to what you would have us use? Third question: will you put the language up
(in a suitably vectorizing form) on the Cray we use at NCAR?

	<mike