[Beowulf] Stroustrup regarding multicore
Robert G. Brown
rgb at phy.duke.edu
Tue Aug 26 14:44:13 PDT 2008
On Tue, 26 Aug 2008, Alan Louis Scheinine wrote:
> I forgot to mention, function calls in Fortran, C or C++ seem to kill
> whereas writing in C++ with data hiding requires (normally) function calls
> to access data. The requirement that Ed Hill described, that an STL vector
> have contiguous memory is wonderful, since it allows the use of
> Fortran / Assembler-like code to do the numerical work while using C++
> for pre- and post- processing.
Yeah, or you could code C++ like C to do the numerical work. But then
one has to ask, why not use C for the whole thing?
The answer, of course, depends on what you get "for free". If C++
library calls do what you need, then it makes sense to code using it.
If you have C libraries that do what you need, why bother with C++? If
the libraries you need are written only in fortran, well, it's use
fortran or do the embed this in that kind of coding and try to build a
best of show program. Just don't ask me to ever maintain it or work on
Language homogeneous is better, IMO, than heterogeneous even at the
expense of best of show. If I'm going heterogeneous, I'll generally put
the barrier between the segments right where it belongs -- in the shell,
with a pipe or other program connector.
Remember, it isn't just what you "can" do; it is how easy is it going to
be to take care of it once it is done. Any nontrivial program is
already almost by definition difficult to debug. Any nontrivial program
using multiple compilers or languages had damn well better have complete
separation at the shell level or debugging will go from difficult to
insanely difficult, really quickly. Then there is the problem with how
many things one person can (normally) do really well -- or how many
languages, operating systems, etc one can work in really well. I've
coded a bit in lots of languages, but I'm only really proficient in C
and perl at this point. I just don't use most of the rest of them if I
can possibly avoid it, and I can possibly avoid it nearly all of the
time these days.
(BTW, embedded assembler in C gets an honorary exemption from this rule
-- it DOES make it insanely difficult to debug if the assembler code is
broken relative to the parent C code, but anybody who would dare to
inline assembler is a damn good programmer and can probably cope.
However, this is a "kids, don't try this at home" sort of thing for
students of programming for quite a ways out, especially nowadays. Not
a lot of CPS classes even teach assembler any more, where when I learned
to code my first introductory class included a section on assembler
(remember "theta" anyone?).
Robert G. Brown Phone(cell): 1-919-280-8443
Duke University Physics Dept, Box 90305
Durham, N.C. 27708-0305
Book of Lilith Website: http://www.phy.duke.edu/~rgb/Lilith/Lilith.php
Lulu Bookstore: http://stores.lulu.com/store.php?fAcctID=877977
More information about the Beowulf