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

Mark Abraham Mark.Abraham at anu.edu.au
Sat Oct 15 01:15:43 CEST 2011


On 15/10/2011 4:48 AM, Mirco Wahab wrote:
> 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
> cmake.
>
> 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:
>   CCDIR=/opt/intel/composer_xe_2011_sp1.6.233/bin/intel64
>
> and it's MKL is located here:
>   MKL_FFTW_INCLUDE=$MKLROOT/include/fftw
>   MKL_FFTW_LIBDIR=$MKLROOT/lib/intel64
>
> 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                  \
>       -DFFTW3F_INCLUDE_DIR=$MKL_FFTW_INCLUDE \
>       -DMKL_LIBRARIES=$MKL_FFTW_LIBDIR       \
>       -DCMAKE_INSTALL_PREFIX=/opt/gromacs455 \
>       -DGMX_X11=OFF                          \
>       -DCMAKE_CXX_COMPILER=${CCDIR}/icpc     \
>       -DCMAKE_C_COMPILER=${CCDIR}/icc        \
>       -DGMX_MPI=OFF                          \
>       -DGMX_PREFER_STATIC_LIBS=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.

I use

ccmake ..\
-DGMX_FFT_LIBRARY=mkl "\
-DMKL_LIBRARIES=${MKL}/lib/em64t/libmkl_intel_thread.so;${MKL}/lib/em64t/libmkl_lapack.so;${MKL}/lib/em64t/libmkl_core.so;${MKL}/lib/em64t/libmkl_em64t.a;${MKL}/lib/em64t/libguide.so;/usr/lib64/libpthread.so" 
\
-DMKL_INCLUDE_DIR=${MKL}/include\
-DGMX_MPI=ON\
-DGMX_THREADS=OFF

in response to reading the MKL documentation for my system - you will 
need to customize this.

Mark

> Before cmake has been priorized, a simple 'configure' call
> would have done it:
>
> --- 8< --- [cut here] ---------------
>
> MINC=/opt/intel/composerxe/mkl/include
> MLIB=/opt/intel/composerxe/mkl/lib/intel64
> ILIB=/opt/intel/composerxe/compiler/lib/intel64
>
> ../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              \
>         --program-suffix=_t
>
> ------------------ [ereh tuc] --- >8 ---
>
>
> How can this be done using cmake?
>
>
> Thank you in advance.
>
> r^b




More information about the gromacs.org_gmx-users mailing list