Keywords: user_guide

Next: 3 Parallelism Up: 2 Installation Previous: 2.6 Running tests and Contents
Subsections

- 2.7.1 All architectures
- 2.7.2 Cray XE and XT machines
- 2.7.3 IBM AIX
- 2.7.4 IBM BlueGene
- 2.7.5 Linux PC
  - 2.7.5.1 Linux PCs with Portland compiler (pgf90)
  - 2.7.5.2 Linux PCs with Pathscale compiler
  - 2.7.5.3 Linux PCs with gfortran
  - 2.7.5.4 Linux PCs with g95
  - 2.7.5.5 Linux PCs with Sun Studio compiler
  - 2.7.5.6 Linux PCs with AMD Open64 suite
  - 2.7.5.7 Linux PCs with Intel compiler (ifort)
  - 2.7.5.8 Linux PCs with MKL libraries
  - 2.7.5.9 Linux PCs with ACML libraries
- 2.7.6 Linux PC clusters with MPI
- 2.7.7 Mac OS
  - 2.7.7.1 Detailed installation instructions for Mac OS X 10.6
  - 2.7.7.2 Compilation with GNU compilers
  - 2.7.7.3 Compilation with Intel compilers

## 2.7 Installation tricks and problems

### 2.7.1 All architectures

- Working Fortran-95 and C compilers are needed in order to compile QUANTUM ESPRESSO. Most ``Fortran-90'' compilers actually implement the Fortran-95 standard, but older versions may not be Fortran-95 compliant. Moreover, C and Fortran compilers must be in your PATH. If `configure` says that you have no working compiler, well, you have no working compiler, at least not in your PATH, and not among those recognized by `configure`.
- If you get Compiler Internal Error or similar messages: your compiler version is buggy. Try to lower the optimization level, or to remove optimization just for the routine that has problems. If it doesn't work, or if you experience weird problems at run time, try to install patches for your version of the compiler (most vendors release at least a few patches for free), or to upgrade to a more recent compiler version.
- If you get error messages at the loading phase that look like file XYZ.o: unknown / not recognized/ invalid / wrong file type / file format / module version, one of the following things have happened:
  1. you have leftover object files from a compilation with another compiler: run `make clean` and recompile.
  2. `make` did not stop at the first compilation error (it may happen in some software configurations). Remove the file *.o that triggers the error message, recompile, look for a compilation error.
  If many symbols are missing in the loading phase: you did not specify the location of all needed libraries (LAPACK, BLAS, FFTW, machine-specific optimized libraries), in the needed order. If only symbols from `clib/` are missing, verify that you have the correct C-to-Fortran bindings, defined in `include/c_defs.h`. Note that QUANTUM ESPRESSO is self-contained (with the exception of MPI libraries for parallel compilation): if system libraries are missing, the problem is in your compiler/library combination or in their usage, not in QUANTUM ESPRESSO.
- If you get an error like Can't open module file global_version.mod: your machine doesn't like the script that produces file `version.f90` with the correct version and revision. Quick solution: copy `Modules/version.f90.in` to `Modules/version.f90`.
- If you get mysterious errors ("Segmentation faults" and the like) in the provided tests and examples: your compiler, or your mathematical libraries, or MPI libraries, or a combination thereof, is very likely buggy, or there is some form of incompatibility (see below). Although the presence of subtle bugs in QUANTUM ESPRESSO that are not revealed during the testing phase can never be ruled out, it is very unlikely that this happens on the provided tests and examples.

### 2.7.2 Cray XE and XT machines

For Cray XE machines:

    $ module swap PrgEnv-cray PrgEnv-pgi
    $ ./configure --enable-openmp --enable-parallel --with-scalapack
    $ vim make.sys

then manually add `-D__IOTK_WORKAROUND1` at the end of `DFLAGS` line.

''Now, despite what people can imagine, every CRAY machine deployed can have different environment. For example on the machine I usually use for tests [...] I do have to unload some modules to make QE running properly. On another CRAY [...] there is also Intel compiler as option and the system is slightly different compared to the other. So my recipe should work, 99% of the cases. I strongly suggest you to use PGI, also for a performance point of view.'' (Info by Filippo Spiga, Sept. 2012)

For Cray XT machines, use `./configure ARCH=crayxt4` or else `configure` will not recognize the Cray-specific software environment.

Older Cray machines: T3D, T3E, X1, are no longer supported.

### 2.7.3 IBM AIX

v.4.3.1 of the CP code, Wannier-function dynamics, crashes with ``segmentation violation'' on some AIX v.6 machines. Workaround: compile it with `mpxlf95` instead of `mpxlf90`. (Info by Roberto Scipioni, June 2011)

On IBM machines with ESSL libraries installed, there is a potential conflict between a few LAPACK routines that are also part of ESSL, but with a different calling sequence. The appearance of run-time errors like ON ENTRY TO ZHPEV PARAMETER NUMBER 1 HAD AN ILLEGAL VALUE is a signal that you are calling the bad routine. If you have defined `-D__ESSL` you should load ESSL before LAPACK: see variable LAPACK_LIBS in make.sys.

### 2.7.4 IBM BlueGene

The current `configure` is tested and works on the machines at CINECA and at Jülich. For other sites, you may need something like

      ./configure ARCH=ppc64-bg BLAS_LIBS=...  LAPACK_LIBS=... \
                  SCALAPACK_DIR=... BLACS_DIR=..."

where the various *_LIBS and *_DIR "suggest" where the various libraries are located.

### 2.7.5 Linux PC

Both AMD and Intel CPUs, 32-bit and 64-bit, are supported and work, either in 32-bit emulation and in 64-bit mode. 64-bit executables can address a much larger memory space than 32-bit executable, but there is no gain in speed. Beware: the default integer type for 64-bit machine is typically 32-bit long. You should be able to use 64-bit integers as well, but it is not guaranteed to work and will not give any advantage anyway.

Currently the following compilers are supported by `configure`: Intel (ifort), Portland (pgf90), gfortran, g95, Pathscale (pathf95), Sun Studio (sunf95), AMD Open64 (openf95). The ordering approximately reflects the quality of support. Both Intel MKL and AMD acml mathematical libraries are supported. Some combinations of compilers and of libraries may however require manual editing of `make.sys`.

It is usually convenient to create semi-statically linked executables (with only libc, libm, libpthread dynamically linked). If you want to produce a binary that runs on different machines, compile it on the oldest machine you have (i.e. the one with the oldest version of the operating system).

If you get errors like IPO Error: unresolved : __svml_cos2 at the linking stage, your compiler is optimized to use the SSE version of sine, cosine etc. contained in the SVML library. Append `-lsvml` to the list of libraries in your `make.sys` file (info by Axel Kohlmeyer, oct.2007).

#### 2.7.5.1 Linux PCs with Portland compiler (pgf90)

QUANTUM ESPRESSO does not work reliably, or not at all, with many old versions (< 6.1) of the Portland Group compiler (pgf90). Use the latest version of each release of the compiler, with patches if available (see the Portland Group web site, `http://www.pgroup.com/`).

#### 2.7.5.2 Linux PCs with Pathscale compiler

Version 3.1 and version 4 (open source!) of the Pathscale EKO compiler work (info by Cezary Sliwa, April 2011, and Carlo Nervi, June 2011). In case of mysterious errors while compiling `iotk`, remove all lines like:

    # 1 "iotk_base.spp"

from all `iotk` source files.

#### 2.7.5.3 Linux PCs with gfortran

Only recent versions (at least v.4.4) of gfortran properly compile QUANTUM ESPRESSO. Older versions often produce nonfunctional phonon executables (segmentation faults and the like); other versions miscompile iotk (the executables work but crash with a mysterious iotk error when reading from data files).

"There is a known incompatibility problem between the calling convention for Fortran functions that return complex values: there is the convention used by g77/f2c, where in practice the compiler converts such functions to subroutines with a further parameter for the return value; gfortran instead produces a normal function returning a complex value. If your system libraries were compiled using g77 (which may happen for system-provided libraries in not-too-recent Linux distributions), and you instead use gfortran to compile QUANTUM ESPRESSO, your code may crash or produce random results. This typically happens during calls to `zdotc`, which is one the most commonly used complex-returning functions of BLAS+LAPACK.

For further details see for instance this link:
`http://www.macresearch.org/lapackblas-fortran-106#comment-17071`
or read the man page of gfortran under the flag `-ff2c`.

If your code crashes during a call to `zdotc`, try to recompile QUANTUM ESPRESSO using the internal BLAS and LAPACK routines (using the `-with-internal-blas` and `-with-internal-lapack` parameters of the configure script) to see if the problem disappears; or, add the `-ff2c` flag" (info by Giovanni Pizzi, Jan. 2013).

Note that a similar problem with complex functions exists with MKL libraries as well: if you compile with gfortran, link `-lmkl_gf_lp64`, not `-lmkl_intel_lp64`, and the like for other architectures. Since v.5.1, you may use the following workaround: add preprocessing option `-Dzdotc=zdotc_wrapper` to `DFLAGS`.

If you experience problems in reading files produced by previous versions of QUANTUM ESPRESSO: ``gfortran used 64-bit record markers to allow writing of records larger than 2 GB. Before with 32-bit record markers only records <2GB could be written. However, this caused problems with older files and inter-compiler operability. This was solved in GCC 4.2 by using 32-bit record markers but such that one can still store >2GB records (following the implementation of Intel). Thus this issue should be gone. See 4.2 release notes (item ``Fortran") at `http://gcc.gnu.org/gcc-4.2/changes.html`." (Info by Tobias Burnus, March 2010).

``Using gfortran v.4.4 (after May 27, 2009) and 4.5 (after May 5, 2009) can produce wrong results, unless the environment variable GFORTRAN_UNBUFFERED_ALL=1 is set. Newer 4.4/4.5 versions (later than April 2010) should be OK. See
`http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43551`." (Info by Tobias Burnus, March 2010).

#### 2.7.5.4 Linux PCs with g95

g95 v.0.91 and later versions (`http://www.g95.org`) work. The executables that produce are however slower (let us say 20% or so) that those produced by gfortran, which in turn are slower (by another 20% or so) than those produced by ifort.

#### 2.7.5.5 Linux PCs with Sun Studio compiler

``The Sun Studio compiler, sunf95, is free (web site: `http://developers.sun.com/sunstudio/` and comes with a set of algebra libraries that can be used in place of the slow built-in libraries. It also supports OpenMP, which g95 does not. On the other hand, it is a pain to compile MPI with it. Furthermore the most recent version has a terrible bug that totally miscompiles the iotk input/output library (you'll have to compile it with reduced optimization).'' (info by Lorenzo Paulatto, March 2010).

#### 2.7.5.6 Linux PCs with AMD Open64 suite

The AMD Open64 compiler suite, openf95 (web site: `http://developer.amd.com/cpu/open64/pages/default.aspx`) can be freely downloaded from the AMD site. It is recognized by `configure` but little tested. It sort of works but it fails to pass several tests (info by Paolo Giannozzi, March 2010). "I have configured for Pathscale, then switched to the Open64 compiler by editing make.sys. "make pw" succeeded and pw.x did process my file, but with "make all" I get an internal compiler error [in CPV/wf.f90]" (info by Cezary Sliwa, April 2011).

#### 2.7.5.7 Linux PCs with Intel compiler (ifort)

The Intel compiler, ifort, is available for free for personal usage (`http://software.intel.com/`). It produces fast executables, at least on Intel CPUs, but not all versions work as expected. ifort versions < 9.1 are not recommended, due to the presence of subtle and insidious bugs. In case of trouble, update your version with the most recent patches, available via Intel Premier support (registration free of charge for Linux): `http://software.intel.com/en-us/articles/intel-software-developer-support`. Since each major release of ifort differs a lot from the previous one, compiled objects from different releases may be incompatible and should not be mixed.

If `configure` doesn't find the compiler, or if you get Error loading shared libraries at run time, you may have forgotten to execute the script that sets up the correct PATH and library path. Unless your system manager has done this for you, you should execute the appropriate script - located in the directory containing the compiler executable - in your initialization files. Consult the documentation provided by Intel.

The warning: feupdateenv is not implemented and will always fail, showing up in recent versions, can be safely ignored. Warnings on "bad preprocessing option" when compiling iotk and complains about ``recommanded formats'' should also be ignored.

ifort v.12: release 12.0.0 miscompiles iotk, leading to mysterious errors when reading data files. Workaround: increase the parameter BLOCKSIZE to e.g. 131072*1024 when opening files in `iotk/src/iotk_files.f90` (info by Lorenzo Paulatto, Nov. 2010). Release 12.0.2 seems to work and to produce faster executables than previous versions on 64-bit CPUs (info by P. Giannozzi, March 2011).

ifort v.11: Segmentation faults were reported for the combination ifort 11.0.081, MKL 10.1.1.019, OpenMP 1.3.3. The problem disappeared with ifort 11.1.056 and MKL 10.2.2.025 (Carlo Nervi, Oct. 2009).

#### 2.7.5.8 Linux PCs with MKL libraries

On Intel CPUs it is very convenient to use Intel MKL libraries. They can be also used for AMD CPU, selecting the appropriate machine-optimized libraries, and also together with non-Intel compilers. Note however that recent versions of MKL (10.2 and following) do not perform well on AMD machines.

`configure` should recognize properly installed MKL libraries. By default the non-threaded version of MKL is linked, unless option `configure -with-openmp` is specified. In case of trouble, refer to the following web page to find the correct way to link MKL:
`http://software.intel.com/en-us/articles/intel-mkl-link-line-advisor/`.

Recent MKL versions also contain optimized FFT routines and a FFTW interface.

For parallel (MPI) execution on multiprocessor (SMP) machines, set the environmental variable OMP_NUM_THREADS to 1 unless you know what you are doing. See Sec.3 for more info on this and on the difference between MPI and OpenMP parallelization.

#### 2.7.5.9 Linux PCs with ACML libraries

For AMD CPUs, especially recent ones, you may find convenient to link AMD acml libraries (can be freely downloaded from AMD web site). `configure` should recognize properly installed acml libraries, together with the compilers most frequently used on AMD systems: pgf90, pathscale, openf95, sunf95.

###
2.7.6 Linux PC clusters with MPI

PC clusters running some version of MPI are a very popular computational platform nowadays. QUANTUM ESPRESSO is known to work with at least two of the major MPI implementations (MPICH, LAM-MPI), plus with the newer MPICH2 and OpenMPI implementation. `configure` should automatically recognize a properly installed parallel environment and prepare for parallel compilation. Unfortunately this not always happens. In fact:

- `configure` tries to locate a parallel compiler in a logical place with a logical name, but if it has a strange names or it is located in a strange location, you will have to instruct `configure` to find it. Note that in many PC clusters (Beowulf), there is no parallel Fortran-95 compiler in default installations: you have to configure an appropriate script, such as mpif90.
- `configure` tries to locate libraries (both mathematical and parallel libraries) in the usual places with usual names, but if they have strange names or strange locations, you will have to rename/move them, or to instruct `configure` to find them. If MPI libraries are not found, parallel compilation is disabled.
- `configure` tests that the compiler and the libraries are compatible (i.e. the compiler may link the libraries without conflicts and without missing symbols). If they aren't and the compilation fails, `configure` will revert to serial compilation.

Apart from such problems, QUANTUM ESPRESSO compiles and works on all non-buggy, properly configured hardware and software combinations. In some cases you may have to recompile MPI libraries: not all MPI installations contain support for the fortran-90 compiler of your choice (or for any fortran-90 compiler at all!).

If QUANTUM ESPRESSO does not work for some reason on a PC cluster, try first if it works in serial execution. A frequent problem with parallel execution is that QUANTUM ESPRESSO does not read from standard input, due to the configuration of MPI libraries: see Sec.3.4. If you are dissatisfied with the performances in parallel execution, see Sec.3 and in particular Sec.3.4.

### 2.7.7 Mac OS

Newer Mac OS-X machines (10.4 and later) with Intel CPUs are supported by `configure`, with gcc4+g95, gfortran, and the Intel compiler ifort with MKL libraries. Parallel compilation with OpenMPI also works.

Mysterious crashes, occurring when `zdotc` is called, are due to the same incompatibility of complex functions with some optimized BLAS as reported in the "Linux PCs with gfortran" paragraph. Workaround: add preprocessing option `-Dzdotc=zdotc_wrapper` to `DFLAGS`.

#### 2.7.7.1 Detailed installation instructions for Mac OS X 10.6

(Instructions for 10.6.3 by Osman Baris Malcioglu, tested as of May 2010) Summary for the hasty:

- GNU fortran: Install macports compilers, Install MPI environment, Configure QUANTUM ESPRESSO using

        ./configure CC=gcc-mp-4.3 CPP=cpp-mp-4.3 CXX=g++-mp-4.3 F77=g95 FC=g95

- Intel compiler: Use Version > 11.1.088, Use 32 bit compilers, Install MPI environment, install macports provided cpp (optional), Configure QUANTUM ESPRESSO using

       ./configure CC=icc CXX=icpc F77=ifort F90=ifort FC=ifort CPP=cpp-mp-4.3

#### 2.7.7.2 Compilation with GNU compilers

. The following instructions use macports version of gnu compilers due to some issues in mixing gnu supplied fortran compilers with apple modified gnu compiler collection. For more information regarding macports please refer to: `http://www.macports.org/`

First install necessary compilers from macports

       port install gcc43
       port install g95

The apple supplied MPI environment has to be overridden since there is a new set of compilers now (and Apple provided mpif90 is just an empty placeholder since Apple does not provide fortran compilers). I have used OpenMPI for this case. Recommended minimum configuration line is:

      ./configure CC=gcc-mp-4.3 CPP=cpp-mp-4.3 CXX=g++-mp-4.3 F77=g95 FC=g95

of course, installation directory should be set accordingly if a multiple compiler environment is desired. The default installation directory of OpenMPI overwrites apple supplied MPI permanently!
Next step is QUANTUM ESPRESSO itself. Sadly, the Apple supplied optimized BLAS/LAPACK libraries tend to misbehave under different tests, and it is much safer to use internal libraries. The minimum recommended configuration line is (presuming the environment is set correctly):

      ./configure CC=gcc-mp-4.3 CXX=g++-mp-4.3 F77=g95 F90=g95 FC=g95 \
                  CPP=cpp-mp-4.3 --with-internal-blas --with-internal-lapack

#### 2.7.7.3 Compilation with Intel compilers

. Newer versions of Intel compiler (>11.1.067) support Mac OS X 10.6, and furthermore they are bundled with intel MKL. 32 bit binaries obtained using 11.1.088 are tested and no problems have been encountered so far. Sadly, as of 11.1.088 the 64 bit binary misbehave under some tests. Any attempt to compile 64 bit binary using v.< 11.1.088 will result in very strange compilation errors.

Like the previous section, I would recommend installing macports compiler suite. First, make sure that you are using the 32 bit version of the compilers, i.e.

    . /opt/intel/Compiler/11.1/088/bin/ifortvars.sh ia32

    . /opt/intel/Compiler/11.1/088/bin/iccvars.sh ia32

will set the environment for 32 bit compilation in my case.

Then, the MPI environment has to be set up for Intel compilers similar to previous section.

The recommended configuration line for QUANTUM ESPRESSO is:

     ./configure CC=icc CXX=icpc F77=ifort F90=ifort FC=ifort CPP=cpp-mp-4.3

MKL libraries will be detected automatically if they are in their default locations. Otherwise, mklvars32 has to be sourced before the configuration script.

Security issues: MacOs 10.6 comes with a disabled firewall. Preparing a ipfw based firewall is recommended. Open source and free GUIs such as "WaterRoof" and "NoobProof" are available that may help you in the process.

Next: 3 Parallelism Up: 2 Installation Previous: 2.6 Running tests and Contents