AMBER: Building Amber 10 with Intel MKL and compiler mini howto

From: Ben Eisenbraun <bene.crystal.harvard.edu>
Date: Wed, 10 Dec 2008 12:45:04 -0500

Howdy Amberites,

After banging my head against it for a few days, I have a working, tested
serial compilation of Amber 10 for OS X Intel using the Intel MKL and
compilers.

A few notes:

I reused the -p4 flag to set optimizations relevant for Intel Macs.
They're all basically Core2Duo or better, and I set the compiler to
optimize for that. If you have one of the first generation Core Duos,
you may need to change the -ax flag.

I (ab)used the -static flag for this build to make it "as static as
possible" given Apple's refusal to support static binaries on OS X.
This part may not be necessary, because I wasn't able to get the
binaries to run witout setting the DYLD_LIBRARY_PATH, which was the
goal in the first place.

So in spite of the -static-intel flags everywhere I could put them, the MKL
libraries seem to still need the DYLD_LIBRARY_PATH (or
DYLD_FALLBACK_LIBRARY_PATH) set in order to run. Without that set, I was
getting errors like:

cd dmp && ./Run.dmp
/programs/i386-mac/ambermd/10/test/dmp
MKL FATAL ERROR: dlopen(libmkl_p4p.dylib, 1): image not found
  ./Run.dmp: Program error

The same goes for the Intel compiler libraries and the Amber Tools:

Running test to make dna duplex:

dyld: Library not loaded: libsvml.dylib
  Referenced from: /private/var/automount/nfs/programs/i386-mac/ambermd/10/test/nab/./duplex
  Reason: image not found

If I add the compiler lib directory to the DYLD_LIBRARY_PATH, it works
fine. With the above flags, settings, etc, the build passes all the tests
for both Amber and Amber Tools.

HTH.

-ben

==

1. Download source, patches, untar, patch, set AMBERHOME, MKL_HOME, etc.

2. Edit configure_at and change:

--- configure_at.orig 2008-12-10 12:21:41.000000000 -0500
+++ configure_at 2008-12-10 12:35:43.000000000 -0500
.. -318,5 +318,5 ..
         blas=skip
         flibs_nab="\$(LIBDIR)/libsym.a \$(LIBDIR)/arpack.a \$(LIBDIR)/f2c.a"
- flibs_mkl="\$(MKL_HOME)/lib/32/libmkl_lapack.a \$(MKL_HOME)/lib/32/libmkl_ia
32.a -L\$(MKL_HOME)/lib/32 -lguide -lpthread"
+ flibs_mkl="-L\$(MKL_HOME)/lib/32 -lmkl_intel -lmkl_core -lmkl_lapack -lguide
 -lpthread"
         if [ "$x86_64" = "yes" ]; then
             flibs_mkl="\$(MKL_HOME)/lib/em64t/libmkl_lapack.a \$(MKL_HOME)/lib/em64t
/libmkl_em64t.a -L\$(MKL_HOME)/lib/em64t -lguide -lpthread"
.. -335,6 +335,6 ..
 
     if [ $p4 = "yes" ]; then
- ocflags=" -O3 -ip -axN"
- offlags=" -w95 -tpp7 -mp1 -ip -O3 -axN"
+ ocflags=" -O3 -ip -axT"
+ offlags=" -w95 -tpp7 -mp1 -ip -O3 -axT"
         flibs_arch="$flibs_arch -lsvml"
     fi
.. -352,6 +352,6 ..
 
     if [ $static = "yes" ]; then
- flibs_nab="$flibs_nab -static"
- ldflags='-static'
+ flibs_nab="$flibs_nab -static-intel"
+ ldflags='-static-intel'
     fi

3. Configure and build:
./configure_at -openmp -static -p4 icc
make -f Makefile_at

4. Test
cd ../test && make -f Makefile_at test, compare results, etc

5. Edit configure_amber and change:

--- configure_amber.orig 2008-12-04 18:00:18.000000000 -0500
+++ configure_amber 2008-12-09 11:46:11.000000000 -0500
.. -222,7 +222,7 ..
 loadcc="$cc"
 loadlib=
 if [ $static = "yes" ]; then
- static_flag='-static'
+ static_flag='-static-intel'
 else
     static_flag=
 fi
.. -1069,8 +1069,8 ..
     ;;
 
 ifort_macosx)
- cc="gcc -m32"
- cplusplus=g++
+ cc="icc"
+ cplusplus=icpc
     cflags="$cflags -O2"
     loadcc="$cc $static_flag"
     fppflags="$fppflags"
.. -1082,11 +1082,11 ..
     fi
 
     fflags="$fflags $verbosity"
- foptflags="$fflags -mp1 -ip -O3"
+ foptflags="$fflags -mp1 -ip -O3 -axT"
     fflags="$fflags -mp1 -O0"
 
     if [ $static = "yes" ]; then
- static_flag='-i-static'
+ static_flag='-static-intel'
     else
        static_flag=
     fi
.. -1115,7 +1115,7 ..
             loadlib="$loadlib $mkll/libmkl_lapack.a $mkll/libmkl_ia32.a -L$mkll -lguide -lpthread"
         else
             # IA-32 dynamic linking of double-precision-LAPACK and kernels
- loadlib="$loadlib -L$mkll -lmkl_lapack -lmkl_ia32 -lguide -lpthread"
+ loadlib="$loadlib -L$mkll -lmkl_intel -lmkl_core -lmkl_lapack -lmkl_intel_thread -lguide -lpthread"
         fi
         fppflags="$fppflags -DMKL"
     fi

6. Configure and build
./configure_amber -p4 -static -nosanderidc ifort_macosx
make serial

7. Test, compare, etc
cd ../test
make test

--
Ben Eisenbraun
Structural Biology Grid                           Harvard Medical School
http://sbgrid.org                                 http://hms.harvard.edu
-----------------------------------------------------------------------
The AMBER Mail Reflector
To post, send mail to amber.scripps.edu
To unsubscribe, send "unsubscribe amber" (in the *body* of the email)
      to majordomo.scripps.edu
Received on Fri Dec 12 2008 - 01:10:49 PST
Custom Search