CCL: Cleaning up dusty deck fortran and converting to C/C++



 Sent to CCL by: "Robert Duke" [rduke#email.unc.edu]
 --Replace strange characters with the "at" sign to recover email
 address--.
 Folks -
 
In discussing how to move forward from f77 to a language with more versatility, I think it is a mistake for the computer science and scientific communities to overlook the virtues of f90/95. There are great prejudices against the old fortran standards in the computer science community, with good reason. Also, that community is now rather heavily steeped in the religion of C/C++ because that series of languages has been tremendously successful, partly due to versatility and partly due to the fact that it was pretty easy to get a decent C compiler implemented on a wide variety of platforms. While f90/95 does not have all the capabilities of C/C++, it does nonetheless introduce a lot of the features for better data structures, algorithms, and sofware engineering practice that people whine (justifiably) about f77 lacking. Giving C/C++ to someone who is not heavily focused on software engineering is like giving a chain saw to a kid. Sharp edges for sure. The nice thing about f90/95 is that f77 ports easily to it and then the ported code can be cleaned up, and better algorithms/data structures can be gradually implemented. Also, the facilities for handling mathematical problems are, at least in my opinion, more intuitive and versatile. Pure computer science guys can moan about the array being a brain dead data structure all they want; it is a useful data structure, and the f95 implementation of multidimensional arrays is easier to use. And f90/f95 can do just about anything in the realm of dynamic data structures as one becomes more adept at using such things. To be sure f90/95 is not perfect; C/C++ is better tied to fundamental OS capabilities, C++ has a real object model, and intermodule dependencies in f90/95 can be awkward to handle. But it is a great next step in a progression from f77. In my view, the CS community has really failed the community of users in the area of practical language development; there is a tendency to either develop beautiful and useless abstractions like pascal, or languages like c which have a combination of sharp edges and subtleties that make them nonideal for someone not devoted to using the tool full time. My personal experience on this is that of someone who has lived in both the CS and science communities, and I have many years of experience developing systems in C/C++. I had personally rather work in C/C++ because it is more fun if you know what you are doing. If I am having to maintain/extend code from someone that does not have a fine appreciation of the finer points of software engineering, however, I had much rather have that code in f90/95. When the code has been C, I have ended up spending a lot of my time fixing the bugs/inefficiencies caused by the fact that the original author did not really understand the subtleties of the language. With the advent of g95, there is now a practical free f90/95 compiler within the reach of everyone; I mostly use proprietary f90/95 implementations due to better performance, but each user can make the choice. I support s/w on just about every type of platform out there for HPC, and I don't have problems with compiler availability.
 Regards  - Bob Duke
 UNC-CH Chem Dept., NIEHS
 
----- Original Message -----
 From: "CCL" <owner-chemistry#ccl.net>
 
 To: "Duke, Robert E " <rduke#email.unc.edu>
 Sent: Sunday, September 25, 2005 12:13 AM
 Subject: CCL: Cleaning up dusty deck fortran and converting to C/C++
 
 Sent to CCL by: "Perry E. Metzger" [perry]_[piermont.com]
 
--Replace strange characters with the "at" sign to recover email address--.
 
 Sadly, the more appropriate languages for this sort of work have become
 desperately unpopular...
 
 I gotta ask: what languages would you consider most appropriate for
 this sort of work (computational chemistry calculations)?
 
 In general, I think it is better to work in strongly typed languages
 which do full run time error checking. Unfortunately, as I said, most
 such languages are now highly unpopular.
 Anyway, any of the Algol descendants (Pascal, Modula-2, Modula-3, even
 Ada) would work quite nicely from the point of view of people used to
 ordinary procedural languages. Unfortunately, compilers for such
 languages are not well maintained these days, because no one cares
 about them any longer. Because of that, C is a reasonable compromise
 for numerically intensive code. The compilers are generally excellent
 and the tools are very good -- but you have to be a damn careful
 programmer not to cut yourself on the sharp edges.
 I wouldn't recommend Java, both because of performance with a VM
 based system for numerical analysis intensive code, and because it
 does not automatically detect numerical overflow/underflow, though it
 does get upset about array bounds violations.
 If your code isn't computationally bound and the slight holes in the
 safety aren't an issue, Java certainly is better for you than C. Of
 course, if you aren't concerned about performance, Python seems even
 nicer. Python is a lot of fun, if a bit odd, but the interpreter is
 very slow. I do not recommend Perl for this sort of thing. (I think
 the bioinformatics people who use it are not using the right tool for
 their job.)
 Believe it or not, I'd actually say that Lisp is a pretty good choice,
 especially the implementations with very good compilers for numerical
 work like CMUCL, SBCL, and various commercial compilers like Allegro
 Common Lisp. Lisp is very alien to non-computer science types, and
 even to many computer scientists, but if you learn it well, it allows
 you to do a whole lot in the way of high quality abstraction -- you
 can write a lot of code very fast, and if you're not using an
 interpreter, the code is often as fast as you can get in any other
 compiled language. Were Lisp not so unloved and so ill supported in
 many environments, I'd push it even harder.
 A word for a moment about tools.
 If you are a cabinet maker, the difference between a good tool and a
 bad tool, and the difference between knowing which tool is good and
 which is bad, and the difference between knowing how to use the good
 tool and not knowing how to use it, all have very obvious impact both
 on the quality of the furniture you build and on how fast you can
 build it. This is entirely obvious.
 However, many computational chemists try to "go cheap" on learning
 about their tools and picking good ones. That means the difference
 between building fast, flexible and maintainable systems quickly, and
 building not so fast, not so flexible and not so maintainable systems
 not so quickly. It is no less obvious with computational chemistry
 than with cabinetmaking that you need to know your tools and know them
 well.
 Computational chemistry is a two part discipline. You really can't
 neglect the computer science side of things any more than you can
 neglect the chemistry side of things. It makes all the difference.
 
Perry> To send e-mail to subscribers of CCL put the string CCL: on your Subject: line> Send your subscription/unsubscription requests to: CHEMISTRY-REQUEST#ccl.net>