Difference between revisions of "LAPACK"

From CBLFS
Jump to navigationJump to search
 
(10 intermediate revisions by one other user not shown)
Line 7: Line 7:
 
----
 
----
  
{{Package-Introduction|LAPACK is a '''L'''inear '''A'''lgebra '''PACK'''age 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]].
+
{{Package-Introduction|LAPACK is a '''L'''inear '''A'''lgebra '''PACK'''age 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 [[ATLAS]].
  
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 (incomplete) or the microprocessor vendor's math library, such as AMD's [[ACML]].|http://www.netlib.org/lapack/}}
  
= LAPACK =
+
{{Note|These instructions do not install the resulting libraries.  Once the LAPACK libraries are built, build [[ATLAS]].  You will then have optimized ATLAS and LAPACK libraries installed.}}
  
 
== Dependencies ==
 
== Dependencies ==
Line 19: Line 19:
 
One of the following is required to build LAPACK:
 
One of the following is required to build LAPACK:
  
[[GCC-3.3]] built with F77 support
+
* [[GCC-3.3]] built with F77 support
[[GCC]] built with gfortran 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 ==
 
== Configuration Information ==
Line 36: Line 32:
 
|}
 
|}
  
<b>NOTE:</b> 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.}}
  
 
== Non-Multilib ==
 
== Non-Multilib ==
Line 42: Line 38:
 
First we create a make.inc to use in our build.
 
First we create a make.inc to use in our build.
  
  cp -v make.inc.example make.inc
+
  cp -v make.inc.example make.inc &&
 +
sed -i 's@../../blas$(PLAT).a@/usr/lib/blas/atlas/libblas.a@' make.inc &&
 +
sed -i "s/OPTS    = -funroll-all-loops/& ${CFLAGS} -fPIC/" make.inc
 +
sed -i "s/NOOPT    =/& -fPIC/" make.inc &&
 +
sed -i "s/EXT_ETIME/INT_CPU_TIME/" 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.
 
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
 
  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/libf77blas.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
 
 
<b>NOTE:</b> 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:
  
 
  make lib
 
  make lib
 
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 the documentation that comes with the LAPACK library:
Line 87: Line 64:
 
First we create a make.inc to use in our build.
 
First we create a make.inc to use in our build.
  
  cp -v make.inc.example make.inc
+
  cp -v make.inc.example make.inc &&
 +
sed -i "s/NOOPT    =/& -fPIC/" make.inc &&
 +
sed -i "s/EXT_ETIME/INT_CPU_TIME/" 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.
 
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
 
  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
 
 
<b>NOTE:</b> 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 ===
Line 107: Line 76:
 
Add your build options to the make file:
 
Add your build options to the make file:
  
sed -i 's/OPTS    = -funroll-all-loops -O3/OPTS    = -funroll-all-loops -O3 ${BUILD32}/' make.inc
+
  sed -i 's@../../blas$(PLAT).a@/usr/lib/blas/atlas/libblas.a@' make.inc &&
 
+
  sed -i "s/OPTS    = -funroll-all-loops/& ${BUILD32} -fPIC/" 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/libf77blas.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:
 
Compile the LAPACK libraries:
  
 
  make lib
 
  make lib
 
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 ===
 
=== N32 ===
Line 130: Line 87:
 
Add your build options to the make file:
 
Add your build options to the make file:
  
sed -i 's/OPTS    = -funroll-all-loops -O3/OPTS    = -funroll-all-loops -O3 ${BUILDn32}/' make.inc
+
  sed -i 's@../../blas$(PLAT).a@/usr/lib32/blas/atlas/libblas.a@' make.inc &&
 
+
  sed -i "s/OPTS    = -funroll-all-loops/& ${BUILDn32} -fPIC/" 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/libf77blas.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:
 
Compile the LAPACK libraries:
  
 
  make lib
 
  make lib
 
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 ===
 
=== 64Bit ===
Line 153: Line 98:
 
Add your build options to the make file:
 
Add your build options to the make file:
  
sed -i 's/OPTS    = -funroll-all-loops -O3/OPTS    = -funroll-all-loops -O3 ${BUILD64}/' make.inc
+
  sed -i 's@../../blas$(PLAT).a@/usr/lib64/blas/atlas/libblas.a@' make.inc &&
 
+
  sed -i "s/OPTS    = -funroll-all-loops/& ${BUILD64} -fPIC/" 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/libf77blas.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:
 
Compile the LAPACK libraries:
  
 
  make lib
 
  make lib
 
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 the documentation that comes with the LAPACK library:
Line 180: Line 113:
 
  done
 
  done
  
== Contents ==
+
[[Category:Science_Engineering]]
 
 
{|style="text-align: left;"
 
|-valign="top"
 
! Installed Libraries:
 
|liblapack.a, libtmg.a
 
|}
 
 
 
=== Short Description ===
 
 
 
{|style="text-align: left;"
 
|-valign="top"
 
!liblapack.a
 
|Library containing the linear algebra functions.
 
|-valign="top"
 
!libtmg.a
 
|Library containg the test matrix generators used in the LAPACK test suite.
 
|}
 
 
 
-----
 
 
 
= LAPACK 95 =
 
 
 
{| style="text-align: left; background-color: AliceBlue;"
 
|-
 
!Download Source:
 
|http://www.netlib.org/lapack95/lapack95.tgz
 
|}
 
 
 
----
 
 
 
{{Package-Introduction|LAPACK95 is a Fortran95 interface to LAPACK.|http://www.netlib.org/lapack95/}}
 
 
 
== Dependencies ==
 
 
 
=== Required ===
 
 
 
* LAPACK
 
 
 
== Configuration Information ==
 
 
 
There is no configure script, but there are several make commands that can be issued depending upon the support you require from your library.  These are:
 
 
 
{|
 
|-valign="top"
 
|<i> make single:</i> provides for single precision library support.
 
|-valign="top"
 
|<i>make double:</i> provides for double precision library support.
 
|-valign="top"
 
|<i>make single_complex:</i> provides for single precision and complex library support.
 
|-valign="top"
 
|<i>make single_double:</i> provides for single and double precisions library support.
 
|-valign="top"
 
|<i>make double_dcomplex:</i> provides for double precision and double complex library support.
 
|-valign="top"
 
|<i>make single_double_complex:</i> provides for single and double precision, and complex library support
 
|-valign="top"
 
|<i>make single_double_complex_dcomplex:</i> provides for single and double precision, complex and double complex library support.
 
|}
 
 
 
== Non-Multilib ==
 
 
 
The LAPACK95 make.inc file assumes that the FORTRAN compiler is named f95.  If you're using the gfortran compiler, correct this:
 
 
 
sed -i 's/f95 -free/gfortran/' make.inc &&
 
sed -i 's/f95 -fixed/gfortran/' make.inc
 
 
 
LAPACK95 assumes the LAPACK source code is in /usr/local/lib/LAPACK3.  The LAPACK source code is required to build the tests.  Correct this to point to the location of your LAPACK source tree:
 
 
 
sed -i 's@/usr/local/lib/LAPACK3/@<PATH_TO_LAPACK_SOURCE_TREE>@' make.inc
 
 
 
Correct the paths to the BLAS and LAPACK libraries on your system:
 
 
 
sed -i 's@$(LAPACK_PATH)/blas.a@<PATH_TO_BLAS_LIBRARY>@' make.inc &&
 
sed -i 's@$(LAPACK_PATH)/lapack.a@<PATH_TO_LAPACK_LIBRARY>@' make.inc &&
 
sed -i 's@$(LAPACK_PATH)/tmglib.a@<PATH_TO_TMG_LIBRARY>@' make.inc
 
 
 
Compile the LAPACK95 library.  Enter the SRC directory and execute ONE of the make commands above:
 
 
 
cd SRC &&
 
make <DESIRED_SUPPORT>
 
 
 
Move the library to a standard location:
 
 
 
cd .. &&
 
cp -v lapack95.a /usr/lib/liblapack95.a
 
 
 
Install the examples if you choose:
 
 
 
install -v -m755 -d /usr/share/doc/LAPACK95/Examples &&
 
cp -v EXAMPLES{1,2}/* /usr/share/doc/LAPACK95/Examples
 
 
 
== Multilib ==
 
 
 
The LAPACK95 make.inc file assumes that the FORTRAN compiler is named f95.  If you're using the gfortran compiler, correct this:
 
 
 
sed -i 's/f95 -free/gfortran/' make.inc &&
 
sed -i 's/f95 -fixed/gfortran/' make.inc
 
 
 
LAPACK95 assumes the LAPACK source code is in /usr/local/lib/LAPACK3.  The LAPACK source code is required to build the tests.  Correct this to point to the location of your LAPACK source tree:
 
 
 
sed -i 's@/usr/local/lib/LAPACK3/@<PATH_TO_LAPACK_SOURCE_TREE>@' make.inc
 
 
 
== 32Bit ==
 
 
 
Add your build options to the make file:
 
 
 
sed -i 's/OPTS0    = -u -V -dcfuns -dusty -ieee=full/OPTS0    = -u -V -dcfuns -dusty -ieee=full ${BUILD32}/' make.inc
 
 
 
Correct the paths to the BLAS and LAPACK libraries on your system:
 
 
 
sed -i 's@$(LAPACK_PATH)/blas.a@<PATH_TO_BLAS_LIBRARY>@' make.inc &&
 
sed -i 's@$(LAPACK_PATH)/lapack.a@<PATH_TO_LAPACK_LIBRARY>@' make.inc &&
 
sed -i 's@$(LAPACK_PATH)/tmglib.a@<PATH_TO_TMG_LIBRARY>@' make.inc
 
 
 
Compile the LAPACK95 library.  Enter the SRC directory and execute ONE of the make commands above:
 
 
 
cd SRC &&
 
make <DESIRED_SUPPORT>
 
 
 
Move the library to a standard location:
 
 
 
cd .. &&
 
cp -v lapack95.a /usr/lib/liblapack95.a
 
 
 
=== N32 ===
 
 
 
Add your build options to the make file:
 
 
 
sed -i 's/OPTS0    = -u -V -dcfuns -dusty -ieee=full/OPTS0    = -u -V -dcfuns -dusty -ieee=full ${BUILD32}/' make.inc
 
 
 
Correct the paths to the BLAS and LAPACK libraries on your system:
 
 
 
sed -i 's@$(LAPACK_PATH)/blas.a@<PATH_TO_BLAS_LIBRARY>@' make.inc &&
 
sed -i 's@$(LAPACK_PATH)/lapack.a@<PATH_TO_LAPACK_LIBRARY>@' make.inc &&
 
sed -i 's@$(LAPACK_PATH)/tmglib.a@<PATH_TO_TMG_LIBRARY>@' make.inc
 
 
 
Compile the LAPACK95 library.  Enter the SRC directory and execute ONE of the make commands above:
 
 
 
cd SRC &&
 
make <DESIRED_SUPPORT>
 
 
 
Move the library to a standard location:
 
 
 
cd .. &&
 
cp -v lapack95.a /usr/lib32/liblapack95.a
 
 
 
=== 64Bit ===
 
 
 
Add your build options to the make file:
 
 
 
sed -i 's/OPTS0    = -u -V -dcfuns -dusty -ieee=full/OPTS0    = -u -V -dcfuns -dusty -ieee=full ${BUILD32}/' make.inc
 
 
 
Correct the paths to the BLAS and LAPACK libraries on your system:
 
 
 
sed -i 's@$(LAPACK_PATH)/blas.a@<PATH_TO_BLAS_LIBRARY>@' make.inc &&
 
sed -i 's@$(LAPACK_PATH)/lapack.a@<PATH_TO_LAPACK_LIBRARY>@' make.inc &&
 
sed -i 's@$(LAPACK_PATH)/tmglib.a@<PATH_TO_TMG_LIBRARY>@' make.inc
 
 
 
Compile the LAPACK95 library.  Enter the SRC directory and execute ONE of the make commands above:
 
 
 
cd SRC &&
 
make <DESIRED_SUPPORT>
 
 
 
Move the library to a standard location:
 
 
 
cd .. &&
 
cp -v lapack95.a /usr/lib64/liblapack95.a
 
 
 
Install the examples if you choose:
 
 
 
install -v -m755 -d /usr/share/doc/LAPACK95/Examples &&
 
cp -v EXAMPLES{1,2}/* /usr/share/doc/LAPACK95/Examples
 
 
 
== Contents ==
 
 
 
{|style="text-align: left;"
 
|-valign="top"
 
! Installed Libraries:
 
|liblapack95.a
 
|}
 
 
 
=== Short Description ===
 
 
 
{|style="text-align: left;"
 
|-valign="top"
 
!liblapack95.a
 
|Library containing the FORTRAN 95 interface to linear algebra functions.
 
|}
 

Latest revision as of 17:39, 19 March 2009

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 ATLAS.

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

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

Caution.png

Note

These instructions do not install the resulting libraries. Once the LAPACK libraries are built, build ATLAS. You will then have optimized ATLAS and LAPACK libraries installed.

Dependencies

Required

One of the following is required to build LAPACK:

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

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 &&
sed -i 's@../../blas$(PLAT).a@/usr/lib/blas/atlas/libblas.a@' make.inc &&
sed -i "s/OPTS     = -funroll-all-loops/& ${CFLAGS} -fPIC/" make.inc
sed -i "s/NOOPT    =/& -fPIC/" make.inc &&
sed -i "s/EXT_ETIME/INT_CPU_TIME/" 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

Compile the LAPACK libraries:

make lib

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 &&
sed -i "s/NOOPT    =/& -fPIC/" make.inc &&
sed -i "s/EXT_ETIME/INT_CPU_TIME/" 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

32Bit

Add your build options to the make file:

sed -i 's@../../blas$(PLAT).a@/usr/lib/blas/atlas/libblas.a@' make.inc &&
sed -i "s/OPTS     = -funroll-all-loops/& ${BUILD32} -fPIC/" make.inc

Compile the LAPACK libraries:

make lib

N32

Add your build options to the make file:

sed -i 's@../../blas$(PLAT).a@/usr/lib32/blas/atlas/libblas.a@' make.inc &&
sed -i "s/OPTS     = -funroll-all-loops/& ${BUILDn32} -fPIC/" make.inc

Compile the LAPACK libraries:

make lib

64Bit

Add your build options to the make file:

sed -i 's@../../blas$(PLAT).a@/usr/lib64/blas/atlas/libblas.a@' make.inc &&
sed -i "s/OPTS     = -funroll-all-loops/& ${BUILD64} -fPIC/" make.inc

Compile the LAPACK libraries:

make lib

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