[Beowulf] Threaded code (& Fortran)

Robert G. Brown rgb at phy.duke.edu
Wed Aug 18 08:05:21 PDT 2004


On Wed, 18 Aug 2004, James Cownie wrote:

> 
> RGB wrote :-
> > Sorry, I don't do fortran.  At least not unless somebody holds my dog
> > hostage or threatens to torch my car.
...
> It may not be that simple in Fortran since you need to be careful about
> which variables are allocated on the stack (and therefore exist
> separately in each thread), and which ones are statically allocated (and
> are therefore shared between all threads).
> 
> As well as common blocks and module variables (which will certainly be
> shared) according to the standard Fortran compilers are free to allocate
> local variables statically in all except recursive
> subroutines/functions. Whether your compiler uses this freedom can
> depend not only the compiler, version and compile flags, but also the
> size of the object, the phase of the moon and other such
> non-deterministic factors.
> 
> Fundamentally you must have a way of telling the compiler that your code
> is to be run in a threaded environment, which likely means that you need
> to use OpenMP. Otherwise you'll be relying on properties of the compiler
> which could change with the next release and are _likely_ to change if
> you move to a new compiler or new machine.

All of which is part of WHY only threats of plastic surgery performed
with a rusty letter opener and staple gun can induce me to use
fortran...;-)

I'm fond of determinism and reproducibility in computer programming...

  rgb

-- 
Robert G. Brown	                       http://www.phy.duke.edu/~rgb/
Duke University Dept. of Physics, Box 90305
Durham, N.C. 27708-0305
Phone: 1-919-660-2567  Fax: 919-660-2525     email:rgb at phy.duke.edu






More information about the Beowulf mailing list