Most problems in installation of OpenMX are caused by the linking of LAPACK and BLAS or its alternative. We would recommend users to link ACML and MKL in most cases, while ACML seems to be slightly better than MKL with respect to computational speed and numerical stability. Examples on how to link them can be found in 'makefile' in the directory 'source'.
Also, we provide a couple of tips for the installation on popular platforms below. OpenMX requires C and FORTRAN compilers, LAPACK and BLAS libraries, and FFT library. In addition, as the C compiler is used for linking, the corresponding FORTRAN library of the compiler should be explicitly specified. Here we provide some sample settings for installation on platforms with several popular compilers and LAPACK and BLAS libraries, with the assumption that the FFT library is installed in /usr/local/fftw3/.
CC=mpicc -O3 -xHOST -openmp -I/usr/local/fftw3/include -I/$MKLROOT/include
FC=mpiifort -O3 -xHOST -openmp -I/$MKLROOT/include
LIB= -L/usr/local/fftw3/lib -lfftw3 -L/$MKLROOT/lib/intel64/ -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -lpthread -lifcore
CC=mpicc -fast -mp -Dnosse -I/usr/local/fftw3/include -I/usr/local/acml/gnu64/include
FC=mpif90 -fast -mp -I/usr/local/acml/gnu64/include
LIB= -L/usr/local/fftw3/lib -lfftw3 /usr/local/acml/gnu64/lib/libacml.a /usr/lib64/libg2c.a -pgf90libs
Important: The preprocessor option -Dnosse must be specified with the PGI C compiler when -mp is used for enabling OpenMP.
CC=mpicc -O3 -ffast-math -fopenmp -I/usr/local/fftw3/include -I/$MKLROOT/include
FC=mpif90 -O3 -ffast-math -fopenmp -I/$MKLROOT/include
LIB= -L/usr/local/fftw3/lib -lfftw3 -L/$MKLROOT/lib/intel64/ -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -lpthread -lgfortran
CC=mpicc -O3 -ffast-math -fopenmp -I/usr/local/fftw3/include -I/usr/local/acml/gnu64/include
FC=mpif90 -O3 -ffast-math -fopenmp -I/usr/local/acml/gnu64/include
LIB= -L/usr/local/fftw3/lib -lfftw3 /usr/local/acml/gnu64/lib/libacml.a -lgfortran
Other combinations of the compiler and LAPACK and BLAS libraries can be done in the same fashion. The following commands can be used to show information about the compiler (Intel, PGI, GNU, etc.) used by MPI.
%mpicc -compile-info (with MPICH) %mpicc -help (with OpenMPI)In some cases, the location of the FORTRAN library is unknown to the C compiler, resulting in the following link errors:
/usr/bin/ld: cannot find -lifcorewith the Intel compiler,
/usr/bin/ld: cannot find -lpgf90with the PGI compiler, or
-lpgf90_rpm1, -lpgf902, -lpgf90rtl, -lpgftnrtlas the "-pgf90libs" flag is just a shortcut for them,
/usr/bin/ld: cannot find -lgfortranwith the GNU compiler.
To solve this link-time problem, the location of the FORTRAN library must be explicitly specified as follows. First, the location of the FORTRAN compiler can be identified with the following commands.
%which ifort (with the Intel compiler) /opt/intel/fce/10.0.026/bin/ifort %which pgf90 (with the PGI compiler) /opt/pgi/linux86-64/7.0/bin/pgf90 %which gfortran (with the GNU compiler) /usr/bin/gfortranThen, the location of the FORTRAN library usually resides in /lib of the parent folder of /bin, and must be specified in LIB.
LIB= ... -L/opt/intel/fce/10.0.026/lib -lifcore (with the Intel compiler) LIB= ... -L/opt/pgi/linux86-64/7.0/lib -pgf90libs (with the PGI compiler) LIB= ... -L/usr/lib -lgfortran (with the GNU compiler)