Quantcast
Channel: Intel Developer Zone Articles
Viewing all articles
Browse latest Browse all 3384

Using Intel MKL BLAS and LAPACK with PETSc

$
0
0

Overview

Summary
This document describes how to build the Portable Extensible Toolkit for Scientific Computation (PETSc) with Intel® Math Kernel Library (Intel® MKL) BLAS and LAPACK.

PETSc (http://www.mcs.anl.gov/petsc/index.html) is a set of libraries that provides functions for building high-performance large-scale applications. PETSc library includes routines for vector manipulation, sparse matrix computations, distributed arrays, linear and non-linear solvers, and extensible PDE solvers.

This application note focuses on building PETSc for Intel® Architecture Processors including IA-32 and Intel® 64 architecture, running Linux*.

Version Information
This document applies to Intel® MKL 2018 update 2  and Intel® Composer XE for Linux* and PETSc 3.8.4

Step 1– Download

PETSc releases are available for download from the PETSc web site at http://www.mcs.anl.gov/petsc/download/index.html
To get Intel® MKL go to /en-us/intel-mkl/.

Step 2 – Configuration

  1. Use the following command to extract the PETSc files. A new folder petsc will be created:
    $git clone -b maint https://bitbucket.org/petsc/petsc petsc
    or
    $ tar –xvzf petsc-3.8.4.tar.gz
  2. Change to the PETSc folder:

$ cd petsc-3.8.4

  1. Set the PETSC_DIR environment variable to point to the location of the PETSc installation folder. For bash shell use:

$ export PETSC_DIR=$PWD

Step 3– Build PETSc

PETSc includes a set of python configuration files which support the use of various compilers, MPI implementations and math libraries. The examples below show options for configuring PETSc to link to Intel MKL BLAS and LAPACK functions. Developers need to ensure that other options are configured appropriately for their system. See the PETSc installation documentation for details: http://www.mcs.anl.gov/petsc/documentation/installation.html#blaslapack

Intel MKL

Intel provides blas/lapack via MKL library. It usually works from GNU/Intel compilers on linux and MS/Intel compilers on Windows. One can specify it to PETSc configure with for eg: --with-blaslapack-dir=/opt/intel/mkl

If the above option does not work - one could determine the correct library list for your compilers using Intel MKL Link Line Advisor and specify with the configure option --with-blaslapack-lib

  1. Invoke the configuration script with the following options to build PETSc with Intel MKL (installed to the default location /opt/intel/mkl).
    • For Intel processors with Intel 64 use the following option:

$ ./config/configure.py
...
--with-blas-lapack-dir=/opt/intel/mkl/lib/intel64

  • For Intel 32-bit processors use the following options:

$ ./config/configure.py
...
--with-blas-lapack-dir==/opt/intel/mkl/lib/ia32

  1. *P.S. If you ​get error message about lack of linking with some other MKL library while you execute python source file, please try to set blas library instead of directory, --with-blas-lapack-lib=\"$MKLROOT/lib/<intel64|ia32>/libmkl_rt.so\"
  2. Use the make file to build PETSc:

    $ make all

Step 4 - Run PETSc

Run the PETSc tests to verify the build worked correctly:

$ make test

Appendix A – System Configuration

PETSc build and testing was completed on a system with an Intel(R) Xeon(R) Silver 4110 CPU @ 2.10GHz running Ubuntu* 16.04.4 LTS

Appendix B - References


Viewing all articles
Browse latest Browse all 3384

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>