Difference between revisions of "LAPACK"

From CBLFS
Jump to navigationJump to search
(Nuts...not working yet after all.)
Line 2: Line 2:
 
|-
 
|-
 
!Download Source:
 
!Download Source:
| http://cross-lfs.org/~arowland/tarballs/l/lapack-lite-autotooled-{{Lapack-Version}}.tar.bz2
+
| http://www.netlib.org/lapack/lapack-{{Lapack-Version}}.tgz
 
|}
 
|}
  
Line 10: Line 10:
  
 
LAPACK libraries can also be obtained from ATLAS or the microprocessor vendor's math library, such as AMD's [[ACML]].|http://www.netlib.org/lapack/}}
 
LAPACK libraries can also be obtained from ATLAS or the microprocessor vendor's math library, such as AMD's [[ACML]].|http://www.netlib.org/lapack/}}
 
{{Note|These instructions use a source package that has been processed by GNU Autotools by a third party.}}
 
  
 
== Dependencies ==
 
== Dependencies ==
Line 22: Line 20:
 
* [[GCC]] built with gfortran support
 
* [[GCC]] built with gfortran support
  
=== Recommended ===
+
=== Optional ===
  
 
Either [[BLAS]] or [[ACML]] are recommended otherwise LAPACK will install an unoptimized version of this library.
 
Either [[BLAS]] or [[ACML]] are recommended otherwise LAPACK will install an unoptimized version of this library.
  
 
== Configuration Information ==
 
== Configuration Information ==
 +
 +
There is no configure script for LAPACK.  All options are set in the make.inc file.  You may wish to modify the following options.
 +
 +
{|
 +
|<i>PLAT=</i> appends the architecture to the library name.  Beneficial if building LAPACK for more than one architecture.
 +
|-
 +
|<i>OPTS=</i> sets the options passed to the FORTRAN compiler.
 +
|}
  
 
{{Note|Do not remove the source tree if you plan to build the LAPACK 95 interface.}}
 
{{Note|Do not remove the source tree if you plan to build the LAPACK 95 interface.}}
Line 32: Line 38:
 
== Non-Multilib ==
 
== Non-Multilib ==
  
First we create a make.inc to use in our build.  Please note that these seds presumes you have CFLAGS and LDFLAGS set.
+
First we create a make.inc to use in our build.
  
If you are using gfortran:
+
cp -v make.inc.example make.inc
  
sed -e "s:g77:gfortran:" \
+
If you haven't built the F77 compiler provided by gcc-3.3, you need to tell LAPACK that you're using gfortran.
    -e "s:-funroll-all-loops -O3:${CFLAGS} $(pkg-config --cflags blas):" \
 
    -e "s:LOADOPTS =:LOADOPTS = ${LDFLAGS} $(pkg-config --cflags blas):" \
 
    -e "s:../../blas\$(PLAT).a:$(pkg-config --libs blas):" \
 
    -e "s:lapack\$(PLAT).a:SRC/.libs/liblapack.a:" make.inc.example > make.inc
 
  
If you are using g77:
+
sed -i 's@g77@gfortran@g' make.inc
  
  sed -e "s:-funroll-all-loops -O3:${CFLAGS} $(pkg-config --cflags blas):" \
+
If you do not have a system BLAS library, tell LAPACK to build its own, unoptimized library:
    -e "s:LOADOPTS =:LOADOPTS = ${LDFLAGS} $(pkg-config --cflags blas):" \
+
 
    -e "s:../../blas\$(PLAT).a:$(pkg-config --libs blas):" \
+
  sed -i 's@lib: lapacklib tmglib@lib: blaslib blas_testing lapacklib tmglib lapack_testing@' Makefile
    -e "s:lapack\$(PLAT).a:SRC/.libs/liblapack.a:" make.inc.example > make.inc
+
 
 +
If you installed the [[BLAS]] library provided by Atlas, tell LAPACK to use this library.  Replace libf77blas.a with the name of your system BLAS FORTRAN library.
 +
 
 +
sed -i 's@../../blas$(PLAT).a@/usr/lib/blas/atlas/libblas.a@' make.inc
 +
 
 +
If you installed the BLAS library provided by [[ACML]], tell LAPACK to use this library.  Replace </path/to/libacml.a> in the command with the actual path to your ACML library.
 +
 
 +
sed -i 's@../../blas$(PLAT).a@</path/to/libacml.a>@' make.inc
 +
 
 +
{{Note|If you want to build and execute the LAPACK test suite, <i>it will fail if you're using the ATLAS BLAS library.</i> From the LAPACK release notes, "The LAPACK test suite needs to be modified to allow for the inversion of diagonal elements, as ATLAS's implementation of xTRSM is valid."  There is currently no patch available so you will need to edit the code manually or skip the test suite.}}
 +
 
 +
If not using the ATLAS BLAS library, tell LAPACK to build and execute the test suite.
 +
 
 +
sed -i 's@lib: lapacklib tmglib@lib: lapacklib tmglib lapack_testing@' Makefile
  
 
Compile the LAPACK libraries:
 
Compile the LAPACK libraries:
Line 54: Line 69:
 
  make
 
  make
  
Install the libraries:
+
Move the libraries to a standard location:
  
  make install
+
  cp -v lapack_LINUX.a /usr/lib/liblapack.a &&
 +
cp -v tmglib_LINUX.a /usr/lib/libtmg.a
  
 
Install the documentation that comes with the LAPACK library:
 
Install the documentation that comes with the LAPACK library:
Line 67: Line 83:
  
 
== Multilib ==
 
== Multilib ==
 +
 +
First we create a make.inc to use in our build.
 +
 +
cp -v make.inc.example make.inc
 +
 +
If you haven't built the F77 compiler provided by gcc-3.3, you need to tell LAPACK that you're using gfortran.
 +
 +
sed -i 's@g77@gfortran@g' make.inc
 +
 +
If you do not have a system BLAS library, tell LAPACK to build its own, unoptimized library:
 +
 +
sed -i 's@lib: lapacklib tmglib@lib: blaslib blas_testing lapacklib tmglib lapack_testing@' Makefile
 +
 +
{{Note|If you want to build and execute the LAPACK test suite, <i>it will fail if you're using the ATLAS BLAS library.</i>  From the LAPACK release notes, "The LAPACK test suite needs to be modified to allow for the inversion of diagonal elements, as ATLAS's implementation of xTRSM is valid."  There is currently no patch available so you will need to edit the code manually or skip the test suite.}}
 +
 +
If not using the ATLAS BLAS library, tell LAPACK to build and execute the test suite.
 +
 +
sed -i 's@lib: lapacklib tmglib@lib: lapacklib tmglib lapack_testing@' Makefile
  
 
=== 32Bit ===
 
=== 32Bit ===
  
First we create a make.inc to use in our build.  Please note that these seds presumes you have CFLAGS and LDFLAGS set.
+
Add your build options to the make file:
  
If you are using gfortran:
+
sed -i 's/OPTS    = -funroll-all-loops -O3/OPTS    = -funroll-all-loops -O3 ${BUILD32}/' make.inc
  
  sed -e "s:g77:gfortran:" \
+
If you installed the [[BLAS]] library provided by Atlas, tell LAPACK to use this library. Replace libf77blas.a with the name of your system BLAS FORTRAN library.
    -e "s:-funroll-all-loops -O3:${BUILD32} $(pkg-config --cflags blas):" \
 
    -e "s:LOADOPTS =:LOADOPTS = ${LD_BUILD32} $(pkg-config --cflags blas):" \
 
    -e "s:../../blas\$(PLAT).a:$(pkg-config --libs blas):" \
 
    -e "s:lapack\$(PLAT).a:SRC/.libs/liblapack.a:" make.inc.example > make.inc
 
  
If you are using g77:
+
sed -i 's@../../blas$(PLAT).a@/usr/lib/blas/atlas/libblas.a@' make.inc
  
  sed -e "s:-funroll-all-loops -O3:${BUILD32} $(pkg-config --cflags blas):" \
+
If you installed the BLAS library provided by [[ACML]], tell LAPACK to use this library. Replace </path/to/libacml.a> in the command with the actual path to your ACML library.
    -e "s:LOADOPTS =:LOADOPTS = ${LD_BUILD32} $(pkg-config --cflags blas):" \
+
 
    -e "s:../../blas\$(PLAT).a:$(pkg-config --libs blas):" \
+
sed -i 's@../../blas$(PLAT).a@</path/to/libacml.a>@' make.inc
    -e "s:lapack\$(PLAT).a:SRC/.libs/liblapack.a:" make.inc.example > make.inc
 
  
 
Compile the LAPACK libraries:
 
Compile the LAPACK libraries:
Line 92: Line 121:
 
  make
 
  make
  
Install the libraries:
+
Move the libraries to a standard location:
 +
 
 +
cp -v lapack_LINUX.a /usr/lib/liblapack.a &&
 +
cp -v tmglib_LINUX.a /usr/lib/libtmg.a
  
make install
 
 
 
=== N32 ===
 
=== N32 ===
  
First we create a make.inc to use in our build.  Please note that these seds presumes you have CFLAGS and LDFLAGS set.
+
Add your build options to the make file:
 +
 
 +
sed -i 's/OPTS    = -funroll-all-loops -O3/OPTS    = -funroll-all-loops -O3 ${BUILDn32}/' make.inc
  
If you are using gfortran:
+
If you installed the [[BLAS]] library provided by Atlas, tell LAPACK to use this library.  Replace libf77blas.a with the name of your system BLAS FORTRAN library.
  
  sed -e "s:g77:gfortran:" \
+
  sed -i 's@../../blas$(PLAT).a@/usr/lib32/blas/atlas/libblas.a@' make.inc
    -e "s:-funroll-all-loops -O3:${BUILDN32} $(pkg-config --cflags blas):" \
 
    -e "s:LOADOPTS =:LOADOPTS = ${LD_BUILDN32} $(pkg-config --cflags blas):" \
 
    -e "s:../../blas\$(PLAT).a:$(pkg-config --libs blas):" \
 
    -e "s:lapack\$(PLAT).a:SRC/.libs/liblapack.a:" make.inc.example > make.inc
 
  
If you are using g77:
+
If you installed the BLAS library provided by [[ACML]], tell LAPACK to use this library.  Replace </path/to/libacml.a> in the command with the actual path to your ACML library.
  
  sed -e "s:-funroll-all-loops -O3:${BUILDN32} $(pkg-config --cflags blas):" \
+
  sed -i 's@../../blas$(PLAT).a@</path/to/libacml.a>@' make.inc
    -e "s:LOADOPTS =:LOADOPTS = ${LD_BUILDN32} $(pkg-config --cflags blas):" \
 
    -e "s:../../blas\$(PLAT).a:$(pkg-config --libs blas):" \
 
    -e "s:lapack\$(PLAT).a:SRC/.libs/liblapack.a:" make.inc.example > make.inc
 
  
 
Compile the LAPACK libraries:
 
Compile the LAPACK libraries:
Line 120: Line 145:
 
  make
 
  make
  
Install the libraries:
+
Move the libraries to a standard location:
  
  make install
+
  cp -v lapack_LINUX.a /usr/lib32/liblapack.a &&
 +
cp -v tmglib_LINUX.a /usr/lib32/libtmg.a
  
 
=== 64Bit ===
 
=== 64Bit ===
  
First we create a make.inc to use in our build.  Please note that these seds presumes you have CFLAGS and LDFLAGS set.
+
Add your build options to the make file:
  
If you are using gfortran:
+
sed -i 's/OPTS    = -funroll-all-loops -O3/OPTS    = -funroll-all-loops -O3 ${BUILD64}/' make.inc
  
  sed -e "s:g77:gfortran:" \
+
If you installed the [[BLAS]] library provided by Atlas, tell LAPACK to use this library. Replace libf77blas.a with the name of your system BLAS FORTRAN library.
    -e "s:-funroll-all-loops -O3:${BUILD64} $(pkg-config --cflags blas):" \
 
    -e "s:LOADOPTS =:LOADOPTS = ${LD_BUILD64} $(pkg-config --cflags blas):" \
 
    -e "s:../../blas\$(PLAT).a:$(pkg-config --libs blas):" \
 
    -e "s:lapack\$(PLAT).a:SRC/.libs/liblapack.a:" make.inc.example > make.inc
 
  
If you are using g77:
+
sed -i 's@../../blas$(PLAT).a@/usr/lib64/blas/atlas/libblas.a@' make.inc
  
  sed -e "s:-funroll-all-loops -O3:${BUILD64} $(pkg-config --cflags blas):" \
+
If you installed the BLAS library provided by [[ACML]], tell LAPACK to use this library. Replace </path/to/libacml.a> in the command with the actual path to your ACML library.
    -e "s:LOADOPTS =:LOADOPTS = ${LD_BUILD64} $(pkg-config --cflags blas):" \
+
 
    -e "s:../../blas\$(PLAT).a:$(pkg-config --libs blas):" \
+
sed -i 's@../../blas$(PLAT).a@</path/to/libacml.a>@' make.inc
    -e "s:lapack\$(PLAT).a:SRC/.libs/liblapack.a:" make.inc.example > make.inc
 
  
 
Compile the LAPACK libraries:
 
Compile the LAPACK libraries:
Line 148: Line 169:
 
  make
 
  make
  
Install the libraries:
+
Move the libraries to a standard location:
  
  make install
+
  cp -v lapack_LINUX.a /usr/lib64/liblapack.a &&
 +
cp -v tmglib_LINUX.a /usr/lib64/libtmg.a
  
 
Install the documentation that comes with the LAPACK library:
 
Install the documentation that comes with the LAPACK library:
Line 165: Line 187:
 
|-valign="top"
 
|-valign="top"
 
! Installed Libraries:
 
! Installed Libraries:
|liblapack.{a,la,so}
+
|liblapack.a, libtmg.a
 
|}
 
|}
  
Line 174: Line 196:
 
!liblapack.a
 
!liblapack.a
 
|Library containing the linear algebra functions.
 
|Library containing the linear algebra functions.
 +
|-valign="top"
 +
!libtmg.a
 +
|Library containg the test matrix generators used in the LAPACK test suite.
 
|}
 
|}

Revision as of 10:32, 29 February 2008

Download Source: http://www.netlib.org/lapack/lapack-3.1.1.tgz

Introduction to LAPACK

LAPACK is a Linear Algebra PACKage that provides routines for solving systems of simultaneous linear equations, least-squares solutions of linear systems of equations, eigenvalue problems, and singular value problems. The associated matrix factorizations (LU, Cholesky, QR, SVD, Schur, generalized Schur) are also provided, as are related computations such as reordering of the Schur factorizations and estimating condition numbers. Dense and banded matrices are handled, but not general sparse matrices. In all areas, similar functionality is provided for real and complex matrices, in both single and double precision. LAPACK routines are written so that as much as possible of the computation is performed by calls to the BLAS.

LAPACK libraries can also be obtained from ATLAS or the microprocessor vendor's math library, such as AMD's ACML.

Project Homepage: http://www.netlib.org/lapack/

Dependencies

Required

One of the following is required to build LAPACK:

  • GCC-3.3 built with F77 support
  • GCC built with gfortran support

Optional

Either BLAS or ACML are recommended otherwise LAPACK will install an unoptimized version of this library.

Configuration Information

There is no configure script for LAPACK. All options are set in the make.inc file. You may wish to modify the following options.

PLAT= appends the architecture to the library name. Beneficial if building LAPACK for more than one architecture.
OPTS= sets the options passed to the FORTRAN compiler.
Caution.png

Note

Do not remove the source tree if you plan to build the LAPACK 95 interface.

Non-Multilib

First we create a make.inc to use in our build.

cp -v make.inc.example make.inc

If you haven't built the F77 compiler provided by gcc-3.3, you need to tell LAPACK that you're using gfortran.

sed -i 's@g77@gfortran@g' make.inc

If you do not have a system BLAS library, tell LAPACK to build its own, unoptimized library:

sed -i 's@lib: lapacklib tmglib@lib: blaslib blas_testing lapacklib tmglib lapack_testing@' Makefile

If you installed the BLAS library provided by Atlas, tell LAPACK to use this library. Replace libf77blas.a with the name of your system BLAS FORTRAN library.

sed -i 's@../../blas$(PLAT).a@/usr/lib/blas/atlas/libblas.a@' make.inc

If you installed the BLAS library provided by ACML, tell LAPACK to use this library. Replace </path/to/libacml.a> in the command with the actual path to your ACML library.

sed -i 's@../../blas$(PLAT).a@</path/to/libacml.a>@' make.inc
Caution.png

Note

If you want to build and execute the LAPACK test suite, it will fail if you're using the ATLAS BLAS library. From the LAPACK release notes, "The LAPACK test suite needs to be modified to allow for the inversion of diagonal elements, as ATLAS's implementation of xTRSM is valid." There is currently no patch available so you will need to edit the code manually or skip the test suite.

If not using the ATLAS BLAS library, tell LAPACK to build and execute the test suite.

sed -i 's@lib: lapacklib tmglib@lib: lapacklib tmglib lapack_testing@' Makefile

Compile the LAPACK libraries:

./configure --prefix=/usr --libdir=/usr/lib/lapack/reference --with-blas="$(pkg-config --libs blas)" &&
make

Move the libraries to a standard location:

cp -v lapack_LINUX.a /usr/lib/liblapack.a &&
cp -v tmglib_LINUX.a /usr/lib/libtmg.a

Install the documentation that comes with the LAPACK library:

install -v -m755 -d /usr/share/doc/LAPACK-3.1.1/html &&
install -v INSTALL/lawn81.{pdf,ps} /usr/share/doc/LAPACK-3.1.1/ &&
for doc in html/*.html; do
  cp -v $doc /usr/share/doc/LAPACK-3.1.1/html
done

Multilib

First we create a make.inc to use in our build.

cp -v make.inc.example make.inc

If you haven't built the F77 compiler provided by gcc-3.3, you need to tell LAPACK that you're using gfortran.

sed -i 's@g77@gfortran@g' make.inc

If you do not have a system BLAS library, tell LAPACK to build its own, unoptimized library:

sed -i 's@lib: lapacklib tmglib@lib: blaslib blas_testing lapacklib tmglib lapack_testing@' Makefile
Caution.png

Note

If you want to build and execute the LAPACK test suite, it will fail if you're using the ATLAS BLAS library. From the LAPACK release notes, "The LAPACK test suite needs to be modified to allow for the inversion of diagonal elements, as ATLAS's implementation of xTRSM is valid." There is currently no patch available so you will need to edit the code manually or skip the test suite.

If not using the ATLAS BLAS library, tell LAPACK to build and execute the test suite.

sed -i 's@lib: lapacklib tmglib@lib: lapacklib tmglib lapack_testing@' Makefile

32Bit

Add your build options to the make file:

sed -i 's/OPTS     = -funroll-all-loops -O3/OPTS     = -funroll-all-loops -O3 ${BUILD32}/' make.inc

If you installed the BLAS library provided by Atlas, tell LAPACK to use this library. Replace libf77blas.a with the name of your system BLAS FORTRAN library.

sed -i 's@../../blas$(PLAT).a@/usr/lib/blas/atlas/libblas.a@' make.inc

If you installed the BLAS library provided by ACML, tell LAPACK to use this library. Replace </path/to/libacml.a> in the command with the actual path to your ACML library.

sed -i 's@../../blas$(PLAT).a@</path/to/libacml.a>@' make.inc

Compile the LAPACK libraries:

./configure --prefix=/usr --libdir=/usr/lib/lapack/reference --with-blas="$(pkg-config --libs blas)" &&
make

Move the libraries to a standard location:

cp -v lapack_LINUX.a /usr/lib/liblapack.a &&
cp -v tmglib_LINUX.a /usr/lib/libtmg.a

N32

Add your build options to the make file:

sed -i 's/OPTS     = -funroll-all-loops -O3/OPTS     = -funroll-all-loops -O3 ${BUILDn32}/' make.inc

If you installed the BLAS library provided by Atlas, tell LAPACK to use this library. Replace libf77blas.a with the name of your system BLAS FORTRAN library.

sed -i 's@../../blas$(PLAT).a@/usr/lib32/blas/atlas/libblas.a@' make.inc

If you installed the BLAS library provided by ACML, tell LAPACK to use this library. Replace </path/to/libacml.a> in the command with the actual path to your ACML library.

sed -i 's@../../blas$(PLAT).a@</path/to/libacml.a>@' make.inc

Compile the LAPACK libraries:

./configure --prefix=/usr --libdir=/usr/lib32/lapack/reference --with-blas="$(pkg-config --libs blas)" &&
make

Move the libraries to a standard location:

cp -v lapack_LINUX.a /usr/lib32/liblapack.a &&
cp -v tmglib_LINUX.a /usr/lib32/libtmg.a

64Bit

Add your build options to the make file:

sed -i 's/OPTS     = -funroll-all-loops -O3/OPTS     = -funroll-all-loops -O3 ${BUILD64}/' make.inc

If you installed the BLAS library provided by Atlas, tell LAPACK to use this library. Replace libf77blas.a with the name of your system BLAS FORTRAN library.

sed -i 's@../../blas$(PLAT).a@/usr/lib64/blas/atlas/libblas.a@' make.inc

If you installed the BLAS library provided by ACML, tell LAPACK to use this library. Replace </path/to/libacml.a> in the command with the actual path to your ACML library.

sed -i 's@../../blas$(PLAT).a@</path/to/libacml.a>@' make.inc

Compile the LAPACK libraries:

./configure --prefix=/usr --libdir=/usr/lib64/lapack/reference --with-blas="$(pkg-config --libs blas)" &&
make

Move the libraries to a standard location:

cp -v lapack_LINUX.a /usr/lib64/liblapack.a &&
cp -v tmglib_LINUX.a /usr/lib64/libtmg.a

Install the documentation that comes with the LAPACK library:

install -v -m755 -d /usr/share/doc/LAPACK-3.1.1/html &&
install -v INSTALL/lawn81.{pdf,ps} /usr/share/doc/LAPACK-3.1.1/ &&
for doc in html/*.html; do
  cp -v $doc /usr/share/doc/LAPACK-3.1.1/html
done

Contents

Installed Libraries: liblapack.a, libtmg.a

Short Description

liblapack.a Library containing the linear algebra functions.
libtmg.a Library containg the test matrix generators used in the LAPACK test suite.
Retrieved from "?title=LAPACK&oldid=13485"