[gmx-users] Link to Intel MKL (fftw) via cmake options

Mirco Wahab mirco.wahab at chemie.tu-freiberg.de
Fri Oct 14 19:48:25 CEST 2011

Dear Gromacs users,

I'm trying to build an Intel-MKL-linked version of
gromacs 4.5.5 and can't figure how to do that using

There are already some (new) instructions on the GROMACS
web site regarding Intel icc but not how to use the
corresponding mkl.

On my system, the Intel 2011 (non commercial) compiler suite
is installed in:

and it's MKL is located here:

 From the examples given in the Gromacs docs (web), I came up
with the following (non-working) cmake invocation:

--- 8< --- [cut here] ---------------

export GMXVERSION=gromacs-4.5.5
export CCDIR=/opt/intel/composer_xe_2011_sp1.6.233/bin/intel64
export MKL_FFTW_INCLUDE=$MKLROOT/include/fftw
export MKL_FFTW_LIBDIR=$MKLROOT/lib/intel64
export CXX=icpc
export CC=icc

cmake ../$GMXVERSION                         \
       -DGMX_FFT_LIBRARY=mkl                  \
       -DCMAKE_INSTALL_PREFIX=/opt/gromacs455 \
       -DGMX_X11=OFF                          \
       -DCMAKE_CXX_COMPILER=${CCDIR}/icpc     \
       -DCMAKE_C_COMPILER=${CCDIR}/icc        \
       -DGMX_MPI=OFF                          \

------------------ [ereh tuc] --- >8 ---

Of course, the setting of *-DMKL_LIBRARIES*=$MKL_FFTW_LIBDIR
is wrong, the specific libraries are expected here.
But how? I didn't find a solution how to touch the
LDFLAGS in the correct way.

Before cmake has been priorized, a simple 'configure' call
would have done it:

--- 8< --- [cut here] ---------------


../gromacs-4.5.4/configure       \
           CC=icc CXX=icpc        \
           CPPFLAGS="-I${MINC}"   \
           LDFLAGS="-L${ILIB} -L${MLIB} -lmkl_intel_ilp64 -lmkl_core  \
                        -lmkl_lapack95_ilp64 -lmkl_blas95_ilp64       \
                        -lmkl_intel_thread -liomp5 -lpthread"         \
         --prefix=/opt/gromacs454 \
         --with-fft=mkl           \
         --with-external-blas     \
         --with-external-lapack   \
         --without-x              \

------------------ [ereh tuc] --- >8 ---

How can this be done using cmake?

Thank you in advance.


More information about the gromacs.org_gmx-users mailing list