4.3.1. Portable, Extensible Toolkit for Scientific Computation (PETSc)


The spectral solver makes use of the »Portable, Extensible Toolkit for Scientific Computation« (PETSc). PETSc is developed as open-source software and can be downloaded from the Argonne National Laboratory.



  • PETSc version 3.10.x is required by DAMASK since revision v2.0.3 (and, hence, for the current release version.)
  • PETSc version 3.9.x is required by DAMASK since revision v2.0.2
  • PETSc version 3.6.x is required by DAMASK since revision 4007
  • PETSc version 3.5.x is required by DAMASK since revision 3460
  • PETSc version 3.4.x is required by DAMASK since revision 2794
  • PETSc version 3.3.x is required by DAMASK prior to revision 2794



DAMASK requires $PETSC_DIR to be set correctly. In case of multiple parallel PETSc installations on a system, make sure that $PETSC_DIR and/or $PETSC_ARCH refer to the intended version.

Mac OS X

> brew install petsc


For recent PETSc versions, use the PETSc backports PPA.

Install from source

For the manual installation, download the source and read the installation instruction. For DAMASK, PETSc needs to be compiled with support for all Fortran 2003 features and needs to be aware of certain external packages.

The following instructions outline how PETSc can be installed.

Automatic resolution of all externalities

The easiest way to configure PETSc for DAMASK is to let PETSc download and install all auxiliary libraries, automatically compile and install them alongside PETSc itself. This process can be done by executing the following configure command inside the directory to which PETSc was downloaded:

> ./configure \
    --with-fc=$F90 --with-cc=$CC --with-cxx=$CXX \
    --download-mpich \
    --download-fftw \
    --download-hdf5 \
    --download-fblaslapack \
    --download-chaco  \
    --download-hypre \
    --download-metis \
    --download-ml \
    --download-mumps \
    --download-parmetis \
    --download-scalapack \
    --download-suitesparse \
    --download-superlu \
    --download-superlu_dist \
    --download-triangle \
    --download-zlib \
    --with-cxx-dialect=C++11 \
    --with-c2html=0 \
    --with-debugging=0 \
    --with-ssl=0 \
    --with-x=0 \
    COPTFLAGS="-O3 -xHost -no-prec-div" CXXOPTFLAGS="-O3 -xHost -no-prec-div" FOPTFLAGS="-O3 -xHost -no-prec-div" \
where the variables $F90, $CC, and $CXX need to point to your Fortrtran, C, and C++ compiler.

After a successful configuration (watch out for error and warning messages), build PETSc with

> make
> make test

This will compile and install a PETSc library with support for Fortran 2003 features, along with all necessary third-party libraries. FFTW, HDF5, BLAS/LAPACK and MPI are the minimum requirement in configuring PETSc for DAMASK spectral solver.

  • Switching off certain features (--with-c2html=0, --with-x=0, --with-ssl=0, and --with-debugging=0) is not mandatory.
  • Optimization flags (COPTFLAGS, CXXOPTFLAGS, and FOPTFLAGS) might be adjusted.


MPI library
If MPI is already installed on your system, the following commands should identify themselves as the compiler of your choice. These names might depend on your MPI library and/or compiler suite.

> mpif90 -v  # equivalent to ifort -v / gortran -v
> mpicc -v   # equivalent to icc -v / gcc -v
> mpicxx -v   # equivalent to icpc -v / g++ -v

In that case, alter the configuration to
    --with-fc=$F90 \
    --with-cc=$CC \
    --with-cxx=$CXX \
    --download-mpich \
    --with-fc=mpif90 \
    --with-cc=mpicc \
    --with-cxx=mpicxx \

Instead of downloading a linear algebra package with --download-fblaslapack, LAPACK, installed as a system package, can be used and will be autodetected:


alternatively, IMKL (located at $MKLROOT/lib/intel64) can be used with

If FFTW is available (exemplarily located at /opt/fftw), don't download it automatically but specify it's location



If HDF5 is available (exemplarily located at /opt/hdf5), don't download it automatically but specify it's location


Deployment directory

To deploy PETSc after building, specify the intended file path with the --prefix option.
> ./configure \
    --prefix=${deploymentDir} \


Known issues

  • segmentation fault — Using PETSc compiled with Intel Fortran but compiling DAMASK using GNU Fortran or using PETSc compiled with GNU Fortran but compiling DAMASK using Intel Fortran might cause a segmentation fault. In an environment where both compilers should be used, compile PETSc with both compilers and select your PETSc version via setting of $PETSC_ARCH.

  • C compiler you provided with -with-cc=icc does not work — This happens if your C compiler (icc in the example) is not located in one of the standard locations but rather available via $PATH and you're installing via sudo. Use sudo su instead of sudo ./configure ...
Topic revision: r54 - 28 Aug 2019, MartinDiehl

  • News
14 Sep 2020
CMCn2020 & DAMASK user meeting to be hosted at Max-Planck-Institut für Eisenforschung (cancelled)
22 Aug 2020
Release of first preview version of DAMASK 3
19 Feb 2020
DAMASK made it to the Advanved Engineering Materials Hall of Fame
26 Mar 2019
DREAM.3D 6.5.119
(released 2019/03/22) comes with a DAMASK export filter
25 Mar 2019
Release of version v2.0.3
21 Jan 2019
DAMASK overview paper finally published with full citation information available
01 Dec 2018
DAMASK overview paper now online
17 Sep 2018
CMCn2018 & DAMASK user meeting to be hosted at Max-Planck-Institut für Eisenforschung
22 May 2018
Release of version v2.0.2
01 Sep 2016
CMCn2016 & DAMASK user meeting to be hosted at Max-Planck-Institut für Eisenforschung
25 Jul 2016
Release of version v2.0.1
08 Mar 2016
Release of version v2.0.0
22 Feb 2016
New webserver up and running
09 Feb 2016
Migrated code repository from Subversion to GitLab
17 Dec 2014
Release of revision 3813
14 May 2014
Release of revision 3108
02 Apr 2014
Release of revision 3062
16 Oct 2013
Release of revision 2689
15 Jul 2013
Release of revision 2555
15 Feb 2013
Release of revision 2174
13 Feb 2013
Doxygen documentation
16 Dec 2012
Powered by MathJax rendering
23 Nov 2012
Release of revision 1955
15 Nov 2012
Release of revision 1924
01 Nov 2012
Updated sidebar
30 Oct 2012
Significant website updates and content extensions

This site is powered by FoswikiCopyright by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding DAMASK? Send feedback
§ Imprint § Data Protection