[Beowulf] Threaded code

Ed Hill eh3 at MIT.EDU
Wed Aug 18 10:45:36 EDT 2004


On Wed, 2004-08-18 at 08:54, Robert G. Brown wrote:
> On Tue, 17 Aug 2004, Art Edwards wrote:

> >  Now we have to learn about building
> > a threaded fortran application. Are there any compiler swithes we need
> > for g77 to build threaded code?

> However, in C using threads is simply a matter of linking in the correct
> thread library:
> 
>   LIBS = -lpthread -lmenu -lpanel -lcurses -lxml2 -lm
> 
> (from a threaded app I wrote).  


Hi Art,

The g77 compiler does not, to the best of my knowledge [1,2], support
any of the parallelization directives similar to those used in OpenMP-
compliant or other (eg. Sun, SGI, Cray) compilers.

However, with gcc and g77 you can call essentially any C routine from
Fortran (and vice-versa) using the "cfortran.h" header available at:

  http://www-zeus.desy.de/~burow/cfortran/

This is not an easy interface to use but it certainly does work (and
works in a surprisingly portable fashion).  In fact, many Fortran codes
use the "cfortran.h" interface to access various C libraries or to
export Fortran-user-friendly interfaces to existing C libs.

So with the cfortran.h interface you can write mixed-language C/Fortran
codes that make use of the pthreads library (POSIX threads included in
glibc) to run various routines in parallel.

Ed

[1] http://zampano.zam.kfa-juelich.de/software/compiler.htm
[2] http://world.std.com/~burley/bof.html


-- 
Edward H. Hill III, PhD
office:  MIT Dept. of EAPS;  Rm 54-1424;  77 Massachusetts Ave.
             Cambridge, MA 02139-4307
emails:  eh3 at mit.edu                ed at eh3.com
URLs:    http://web.mit.edu/eh3/    http://eh3.com/
phone:   617-253-0098
fax:     617-253-4464

_______________________________________________
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