Page 1 of 1

LAPACK with ATLAS

PostPosted: Tue May 16, 2006 12:59 pm
by snalim
Hello,

I ran over the following problem when compiling LAPACK with ATLAS under Ubuntu 5.10 using g77 3.4.5.

When compiling testing routines (xlintsts) of LAPACK, I get lots of undefined references like

Code: Select all
../../lapack_P4SSE2_ATLAS_g77.a(slarz.o): In function `slarz_':
slarz.f:(.text+0xac): undefined reference to `scopy_'
slarz.f:(.text+0xed): undefined reference to `sgemv_'
slarz.f:(.text+0x11a): undefined reference to `saxpy_'
slarz.f:(.text+0x183): undefined reference to `scopy_'
slarz.f:(.text+0x1c1): undefined reference to `sgemv_'
slarz.f:(.text+0x1ea): undefined reference to `saxpy_'
slarz.f:(.text+0x22b): undefined reference to `sger_'
../../lapack_P4SSE2_ATLAS_g77.a(slauu2.o): In function `slauu2_':
slauu2.f:(.text+0xb5): undefined reference to `sscal_'
slauu2.f:(.text+0x106): undefined reference to `sdot_'
slauu2.f:(.text+0x166): undefined reference to `sgemv_'
slauu2.f:(.text+0x235): undefined reference to `sscal_'
slauu2.f:(.text+0x289): undefined reference to `sdot_'
slauu2.f:(.text+0x2ea): undefined reference to `sgemv_'


I want to use ATLAS as an optimized BLAS library, so my make.inc file for LAPACK is:

Code: Select all
####################################################################
#  LAPACK make include file.                                       
#  LAPACK, Version 3.0                                             
#  June 30, 1999                                                 
####################################################################
#
SHELL = /bin/sh
#
#  The machine (platform) identifier to append to the library names
#
PLAT = _P4SSE2_ATLAS_g77

#  Modify the FORTRAN and OPTS definitions to refer to the
#  compiler and desired compiler options for your machine.  NOOPT
#  refers to the compiler options desired when NO OPTIMIZATION is
#  selected.  Define LOADER and LOADOPTS to refer to the loader and
#  desired load options for your machine.
#
FORTRAN  = g77
#OPTS     = -O4 -u -f -mt
#OPTS     = -u -f -dalign -native -xO5 -xarch=v8plusa
OPTS     =  -O3
DRVOPTS  = $(OPTS)
NOOPT    = -O0
#NOOPT    = -u -f -mt
LOADER   = g77
#LOADOPTS = -mt
LOADOPTS = -O3
#
#  The archiver and the flag(s) to use when building archive (library)
#  If you system has no ranlib, set RANLIB = echo.
#
ARCH     = ar
ARCHFLAGS= cr
RANLIB   = ranlib
#
#  The location of the libraries to which you will link.  (The
#  machine-specific, optimized BLAS library should be used whenever
#  possible.)
#
#BLASLIB      = ../../blas$(PLAT).a
#BLASLIB     = -xlic_lib=sunperf_mt
BLASlib      = -L/opt/ATLAS/lib/Linux_P4SSE2_gcc4-0-2/ -lfblas -latlas
#BLASLIB      = -L/opt/GotoBLAS/ -lgoto
LAPACKLIB    = lapack$(PLAT).a
TMGLIB       = tmglib$(PLAT).a
EIGSRCLIB    = eigsrc$(PLAT).a
LINSRCLIB    = linsrc$(PLAT).a


When I use the (here commented) BLASLIB variable to link with K. Goto's BLAS, everything works fine, so there must be something wrong with the way I link to the ATLAS library (but the library itself should be OK as it passed all its tests).

Moreover, after successfully compiling the CLAPACK library with ATLAS I deduce that there must be some problem with fortran compiler with which I compile the LAPACK lib. But (among others I tested) I used precisely the same g77 that I specified during ATLAS installation. If I got it well, all the interoperability between gcc used to compile ATLAS and g77 for the fortran interface should be taken care of by that. Howewer, it didn't work either.

I apologise if this post should not belong here or was answered elsewhere, but after full day of googling and trying I'm running out of time and still can't see why it doesn't work. Many thanks in advance for any response!

PostPosted: Tue May 16, 2006 2:31 pm
by Julien Langou
Hello

(1) try -lf77blas instead -lfblas in BLASlib

(at least that's what you should have with an original ATLAS)

(2) and put BLASLIB not BLASlib

(I think your problem comes from (2) )

-Julien

PostPosted: Tue May 16, 2006 3:14 pm
by snalim
Thank you very much for answering my stupid question, the answer was one line up and I couldn't see it :oops: