Using Intel MKL BLAS and LAPACK with PETSc

Step 1 – Overview

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 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 11.0 and Intel Composer XE for Linux* and PETSc 3.3-p3.

Step 2 – Download

PETSc releases are available for download from the PETSc web site at
To purchase or download a 30-day evaluation version of Intel MKL go to /en-us/intel-mkl/.

Step 3 – Configuration

  1. Use the following command to extract the PETSc files. A new folder petsc-3.3-p3 will be created:

    $ tar –xvzf petsc-3.3-p3.tar.gz

  2. Change to the PETSc folder:

    $ cd petsc-3.3-p3

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

  1. Invoke the configuration script with the following options to build PETSc with Intel MKL 10.3 or Intel Composer XE  (installed to the default location /opt/intel/mkl).

    • For Intel processors with Intel 64 use the following option:

      $ ./config/

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

      $ ./config/

  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® Xeon® CPU X5570 running RedHat Enterprise Linux* 6.0

Appendix B - References