Difference between revisions of "LAPACK"

From PHASTA Wiki
Jump to: navigation, search
(Created page with "== Download and Build LAPACK == 1. Download LAPACK tarball from http://netlib.org/lapack/ and extract the files to the desired folder with <code> tar -xf <name_of_tarball> </c...")
 
Line 1: Line 1:
 
== Download and Build LAPACK ==
 
== Download and Build LAPACK ==
1. Download LAPACK tarball from http://netlib.org/lapack/ and extract the files to the desired folder with <code> tar -xf <name_of_tarball> </code>. Note that for the current method, the location of the unpacked folder does not need to be within the PHASTA source directory.
+
First download LAPACK tarball from http://netlib.org/lapack/ and extract the files with <code> tar -xf <name_of_tarball> </code>, which produced folder 'lapack-3.9.1' for this example. Note that for the current method, the location of the unpacked folder does not need to be within the PHASTA source directory.
  
<code> cp <lapack_dir>/make.inc.example <lapack_dir>/make.inc </code>
+
Create a copy of the provided make include file with
 +
<code> cp lapack-3.9.1/make.inc.example lapack-3.9.1/make.inc </code> and modify make.inc with any platform specific changes that are needed (for viz002 no changes were needed).
  
2. Create a build directory at the same level as the LAPACK folder and execute the following build script within the build directory:
+
At the same level as the lapack-3.9.1 folder, create and change to a build directory, <build_lapack_dir> and execute the following from within the build directory, followed by <code> make -j </code>.
<code>
+
<nowiki>
 
#!/bin/bash
 
#!/bin/bash
 
cmake \
 
cmake \
Line 11: Line 12:
 
-DCMAKE_Fortran_COMPILER=gfortran \
 
-DCMAKE_Fortran_COMPILER=gfortran \
 
-DCMAKE_BUILD_TYPE=Release \
 
-DCMAKE_BUILD_TYPE=Release \
../<lapack_dir>
+
../lapack-3.9.1 </nowiki>
</code>
+
 
 +
The directory <build_lapack_dir>/lib/ should now contain libblas.a and liblapack.a library files. These are the files that will be linked to when compiling PHASTA.
 +
 
 +
== Modify CMakeLists.txt File ==
 +
Add the following flags to the build script that you would normally execute when compiling PHASTA
 +
<nowiki>
 +
-DPHASTA_USE_LAPACK=ON \
 +
-DLAPACKBLAS_DIR=</path/to/build_lapack_dir>/lib/ \ </nowiki>

Revision as of 15:02, 15 April 2021

Download and Build LAPACK

First download LAPACK tarball from http://netlib.org/lapack/ and extract the files with tar -xf <name_of_tarball> , which produced folder 'lapack-3.9.1' for this example. Note that for the current method, the location of the unpacked folder does not need to be within the PHASTA source directory.

Create a copy of the provided make include file with cp lapack-3.9.1/make.inc.example lapack-3.9.1/make.inc and modify make.inc with any platform specific changes that are needed (for viz002 no changes were needed).

At the same level as the lapack-3.9.1 folder, create and change to a build directory, <build_lapack_dir> and execute the following from within the build directory, followed by make -j .

#!/bin/bash
cmake \
-DCMAKE_C_COMPILER=gcc \
-DCMAKE_Fortran_COMPILER=gfortran \
-DCMAKE_BUILD_TYPE=Release \
../lapack-3.9.1 

The directory <build_lapack_dir>/lib/ should now contain libblas.a and liblapack.a library files. These are the files that will be linked to when compiling PHASTA.

Modify CMakeLists.txt File

Add the following flags to the build script that you would normally execute when compiling PHASTA

-DPHASTA_USE_LAPACK=ON \
-DLAPACKBLAS_DIR=</path/to/build_lapack_dir>/lib/ \