help-gsl
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-gsl] GSL on OSX: Optimal compilation and linking to Fortran


From: Stephen Cornell
Subject: [Help-gsl] GSL on OSX: Optimal compilation and linking to Fortran
Date: Wed, 17 Nov 2004 13:36:52 +0000

Platform: Powermac G5 dual 2.5GHZ, Mac OSX 10.3.6
GSL 1.5, compiled with GCC 3.3 and CFLAGS="-Wno-long-double -O3 -funroll-loops -mtune=G5 -mcpu=G5 -mpowerpc64"
IBM XL Fortran 8.1

What is the best way to get good performance from GSL compiled with GCC, linked to Fortran programs compiled with IBM XL Fortran?

I was delighted to discover that it is straightforward to call GSL routines from Fortran programs compiled with IBM XF Fortran. All that is required is to use call-by-value for the arguments using %VAL() in the Fortran program, and compile with -U to preserve the case of function names. However, binaries created in this way seem to run very slowly compared with other libraries, compilers, or platforms. For instance, I have some simulation code that frequently calculates a Bessel function. Sample run times (using 64 bit reals throughout):

Powermac, using gsl-sf-besselK0, IBM XLF: 190 secs
Powermac, using bessk0 from Numerical recipes for Fortran, IBM XLF: 60 secs Athlon 1.53GHZ/Linux, using DBK0 from libssl2 and Lahey Fujitsu Fortran 9.5: 135 secs

When using other code with no external library, the Powermac/XLF is typically faster than the Athlon/LF9561 by a factor of two or so - which is what I would expect given the G5 is a 64 bit processor running at a higher clock speed.

Are there obvious things to add to CFLAGS (see above) when compiling GSL to get the required performance boost? Would I get a huge improvement if I compiled GSL with the IBM XLC compiler, for which I don't currently have a license? Is the problem unavoidable, given that I'm linking C code to Fortran code? Are the GSL routines just much more careful, and therefore slower?

--
Stephen Cornell    address@hidden +44-113-3432899
School of Biology, University of Leeds, Leeds, LS2 9JT, UK





reply via email to

[Prev in Thread] Current Thread [Next in Thread]