For Programmers: Free Programming Magazines  


Home > Archive > Fortran > April 2005 > Compiling LAPACK with ATLAS on cygwin using g95









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Compiling LAPACK with ATLAS on cygwin using g95
Peter Simon

2005-04-18, 8:58 pm

I would like to test out one of my computational electromagnetics codes with g95
under cygwin. I normally compile it using Intel Fortran and link it against the
Intel MKL, which takes care of all the LAPACK and BLAS calls.

To make the comparison fairer I would like to employ a well-optimized set of
BLAS, i.e., the ATLAS BLAS, when I compile and link with g95. However, I seem
to recall that g95 can not link against g77-compatible libraries. Is this
correct? If so, is there a way to compile/install the ATLAS BLAS under cygwin
in a way that is compatible with g95? Also, are there any gotchas to look out
for when compiling LAPACK under cygwin with the g95 compiler?

Thanks,
Peter
Peter Simon

2005-04-25, 3:59 pm

Peter Simon wrote:
> I would like to test out one of my computational electromagnetics codes
> with g95 under cygwin. I normally compile it using Intel Fortran and
> link it against the Intel MKL, which takes care of all the LAPACK and
> BLAS calls.
>
> To make the comparison fairer I would like to employ a well-optimized
> set of BLAS, i.e., the ATLAS BLAS, when I compile and link with g95.
> However, I seem to recall that g95 can not link against g77-compatible
> libraries. Is this correct? If so, is there a way to compile/install
> the ATLAS BLAS under cygwin in a way that is compatible with g95? Also,
> are there any gotchas to look out for when compiling LAPACK under cygwin
> with the g95 compiler?
>
> Thanks,
> Peter


Due to the overwhelming response to the first post in this thread (;-)) I got
off my duff and installed both ATLAS BLAS and LAPACK3E under cygwin. There
were quite a large number of errors reported in the LAPACK3e tests, but they did
not involve solvers for complex*16 general matrices, the case I am currently
interested in, so I didn't attempt to understand nor fix them.

Using the g95 compiler under cygwin, I was able to compile both LAPACK3E and my
freqency/polarization selective surface code PSS. PSS is written in Fortran 95
and consists of about 45,000 lines of code. It makes extensive use of derived
types containing pointer arrays, along with many other Fortran 95 features. I
was quite surprised that g95 successfully compiled the program. Better yet, the
program ran and gave correct results! Below, I present a comparison of the
timings for the program compiled with Compaq Visual Fortran (CVF) 6.6c, Intel
Visual Fortran (IVF) 8.1, and g95. The IVF and CVF versions used the Intel Math
Kernel Library (MKL) as the source of LAPACK and BLAS routines.

Compiler Run Time (sec)
-------- --------------
IVF 1297
g95 2130
CVF 2843

Some notes on the types of computations done by this benchmark: Most of the CPU
time is spent generating the elements several matrices and then solving the
resulting matrix equations. The matrix generation calculations involve
complex*16 arithmetic and exponentials and trig functions of complex arguments,
along with various special functions. There is also quite a bit of integer
arithmetic involved in the geometric/topological calculations associated with
triangulation of the analysis domain. The number of unknowns is 1370. For this
sized system, most of the CPU time is spent on matrix generation. I noted that
LU factorization of the matrices using the cygwin-compiled LAPACK and ATLAS BLAS
was nearly as fast as using the Intel MKL: 2.0 seconds for the former and 1.9
seconds for the latter. I speculate that the speed difference may be due to the
fact that I compiled ATLAS for a serial machine, while the MKL is threaded and
may be taking advantage of my dual processors.

The IVF compiler options were: /O3 /Qip /QaxNP
The CVF compiler options were the default options provided when selecting the
"Release" configuration. The g95 compiler options were: -O3 -ffast-math
-march=pentium4. I also tried the g95 options: -O3 -ffast-math
-march=pentium4 -mtune=pentium4 -msse2 -mfpmath=sse but the execution time was
greater for some reason when these options were specified.

My machine is a dual-processor P4 workstation with 4 Gbytes of RAM. The Intel
Processor Frequency ID utility reports the following characteristics:
CPU Type: 0, CPU Family: F, CPU Model: 2, CPU Stepping: 9, CPU Revision: 22,
Level 3 cache: None, Level 2 cache: 512 KB, Level 1 data cache: 8 KB, MMX: Yes,
NetBurst: Yes, Hyper-Threading: No, SSE: Yes, SSE2: Yes, SSE3: No.

Conclusion: Although the g95-compiled code is not as fast as the Intel-compiled
code, it beat the pants off the CVF compiler, which used to hold title as the
top windows Fortran 95 compiler. The fact that g95 compiles this large,
extremely complex code and generates correct results is nothing less than
amazing to me. Extreme kudos to Andy and the other developers of g95. As for
speed, I've been reading that major advances in optimization are in store for
the Gnu Compiler Collection (GCC), which I hope will also be exploited by g95.

PS: Why didn't I compile my code with gfortran, you ask? I've been trying to
compile some other smaller codes with it and haven't had success yet. I will
continue experimenting with it as it matures.

PPS: Bug in g95/cygwin: When I compile the code with -mno-cygwin I get memory
allocation errors. Not quite sure who to report this to, g95 or gcc or cygwin?

--Peter
Peter Simon

2005-04-25, 8:57 pm

Peter Simon wrote:
--<snip>--
>
> PPS: Bug in g95/cygwin: When I compile the code with -mno-cygwin I get
> memory allocation errors. Not quite sure who to report this to, g95 or
> gcc or cygwin?
>
> --Peter


Andy Vaught alerted Dave Miles who responded almost immediately and showed me
how to increase the heap size for the executable by passing the linker an option
on the g95 command line:

g95 -Wl,--heap=0x10000000 -mno-cygwin ...

which fixes the memory allocation error I was complaining about.

--Peter
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2009 codecomments.com