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

Mirco Wahab wahab-mail at gmx.de
Sat Oct 15 12:02:45 CEST 2011


On 10/15/2011 1:15 AM, Mark Abraham wrote:
> 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

Thanks for your hints, I made it now through `cmake` with:

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

GMXVERSION=gromacs-4.5.5
GMXTARGET=/opt/gromacs455

MINC=/opt/intel/composerxe/mkl/include
MLIB=/opt/intel/composerxe/mkl/lib/intel64
ILIB=/opt/intel/composerxe/lib/intel64
LLIB=/usr/lib64

export CXX=icpc
export CC=icc

cmake ../$GMXVERSION  \
       -DGMX_FFT_LIBRARY=mkl
"-DMKL_LIBRARIES=${MLIB}/libmkl_intel_ilp64.so;${MLIB}/libmkl_core.so;${MLIB}/libmkl_intel_thread.so;${ILIB}/libiomp5.so;${LLIB}/libpthread.so"\
       -DMKL_INCLUDE_DIR=${MINC} \
       -DGMX_MPI=OFF             \
       -DGMX_THREADS=ON          \
       -DCMAKE_INSTALL_PREFIX=${GMXTARGET}  \
       -DGMX_X11=OFF                        \
       -DGMX_BINARY_SUFFIX="_t"

-------------------------------------------------------------------

on `make`, there are still some compiler flag related
problems. The cmake scripts invoked by the command
above identified the Intel64 compiler and guessed
'almost correct' optimization and code-generation options:
(Compiler: /opt/intel/composer_xe_2011_sp1.6.233/bin/intel64/ic*)

--- [CMakeCache.txt] ---------------------------------------------

...

//Flags used by the compiler during all build types
CMAKE_CXX_FLAGS:STRING=' -msse2 -ip -funroll-all-loops -std=gnu99  '

//Flags used by the compiler during release builds.
CMAKE_CXX_FLAGS_RELEASE:STRING=-mtune=itanium2 -mtune=core2  -O3 -DNDEBUG

//Flags used by the compiler during all build types
CMAKE_C_FLAGS:STRING=' -msse2 -ip -funroll-all-loops -std=gnu99  '

//Flags used by the compiler during release builds.
CMAKE_C_FLAGS_RELEASE:STRING=-mtune=itanium2 -mtune=core2  -O3 -DNDEBUG

...

--------------------------------------------------------------------

These are obviously the wrong flags for the detected architecture,
sse2 is no longer available and so are the the mtune architectures.

The correct options for the actual compiler for Intel64 would read:

    CMAKE_CXX_FLAGS:STRING=' -msse3 -ip -funroll-all-loops -std=gnu99 '
    CMAKE_CXX_FLAGS_RELEASE:STRING=-O3 -DNDEBUG

    CMAKE_C_FLAGS:STRING=' -msse3 -ip -funroll-all-loops -std=gnu99  '
    CMAKE_C_FLAGS_RELEASE:STRING=-O3 -DNDEBUG


Even with the wrong options, the `make` would eventually succeed
with some option-warnings but without error.

But the install is broken. On `make install-mdrun`, the scripts would
remove any library from "src/gmxlib/CMakeFiles/CMakeRelink.dir"
and bail out with the error below. Even if you copy the libraries
by hand to CMakeRelink.dir/, the'll get removed by make install-mdrun
before trying to link with them.

--- [cat errmsg.txt] ---------------------------------------------

[ 70%] Built target gmx
[ 89%] Built target md
[ 98%] Built target gmxpreprocess
[100%] Built target mdrun
[100%] Installing mdrun
-- Install configuration: "Release"
-- Install component: "libraries"
CMake Error at /x/y/Gromacs/build/src/gmxlib/cmake_install.cmake:38 (FILE):
    file INSTALL cannot find
    "/x/y/Gromacs/build/src/gmxlib/CMakeFiles/CMakeRelink.dir/libgmx.so.6".

--------------------------------------------------------------------

Still broken with the new Intel Compiler but probably close ;-)

Thanks and regards,

r^b




More information about the gromacs.org_gmx-users mailing list