Closed miroi closed 9 years ago
Manual compiling with icc and linging against MKL works, see:
milias@login.grid.umb.sk:~/Work/qch/software/software_projects/autocmake_devel/autocmake_miroi/test/cc_cblas/src/.icc -D HAVE_MKL_BLAS example.c -L /mnt/apps/intel/composer_xe_2013_sp1.1.106/mkl/lib/intel64 -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -openmp
Using Intel MKL <mkl_cblas.h> interface
milias@login.grid.umb.sk:~/Work/qch/software/software_projects/autocmake_devel/autocmake_miroi/test/cc_cblas/src/.ldd a.out
linux-vdso.so.1 => (0x00007fffc131a000)
libmkl_intel_lp64.so => /mnt/apps/intel/composer_xe_2013_sp1.1.106/mkl/lib/intel64/libmkl_intel_lp64.so (0x00007fb77c84a000)
libmkl_intel_thread.so => /mnt/apps/intel/composer_xe_2013_sp1.1.106/mkl/lib/intel64/libmkl_intel_thread.so (0x00007fb77b88b000)
libmkl_core.so => /mnt/apps/intel/composer_xe_2013_sp1.1.106/mkl/lib/intel64/libmkl_core.so (0x00007fb77a1cd000)
libm.so.6 => /lib64/libm.so.6 (0x00007fb779f31000)
libiomp5.so => /mnt/apps/intel/composer_xe_2013_sp1.1.106/compiler/lib/intel64/libiomp5.so (0x00007fb779c15000)
libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007fb7799ff000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fb7797e2000)
libc.so.6 => /lib64/libc.so.6 (0x00007fb77944d000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007fb779249000)
/lib64/ld-linux-x86-64.so.2 (0x00007fb77cf8f000)
milias@login.grid.umb.sk:~/Work/qch/software/software_projects/autocmake_devel/autocmake_miroi/test/cc_cblas/src/.a.out
PASSEDmilias@login.grid.umb.sk:~/Work/qch/software/software_projects/autocmake_devel/autocmake_miroi/test/cc_cblas/src/.
In such situations please compare the generated link line with your working link line and try to figure out why it breaks.
Hi,
unfortunately, this approach does not work - in my case it did not detect the MKL blas/lapack library at all.
I played a lot with math_libs.cmake , some macro inside did not detect the library, and thus did not set BLAS_FOUND/LAPACK_FOUND.
For that reason I would be glad to have some control (verbosity) printouts in math_libs.cmake, serving us, developers.
Ah sorry yes my comment was not helpful. I forgot that the problem is detection and not linking.
Related problem with --mkl=parallel, see:
milias@login.grid.umb.sk:~/Work/qch/software/software_projects/autocmake_devel/autocmake_miroi/test/cc_cblas/.python setup.py --cc=icc --mkl=paralell build_icc_mklCC=icc cmake -DEXTRA_CFLAGS="''" -DENABLE_STATIC_LINKING=False -DENABLE_BLAS=auto -DENABLE_LAPACK=auto -DMKL_FLAG=paralell -DMATH_LIB_SEARCH_ORDER="MKL;ESSL;ATLAS;ACML;SYSTEM_NATIVE" -DBLAS_LANG=Fortran -DLAPACK_LANG=Fortran -DCMAKE_BUILD_TYPE=release -G "Unix Makefiles" /home/milias/Work/qch/software/software_projects/autocmake_devel/autocmake_miroi/test/cc_cblas
-- The C compiler identification is Intel 14.0.0.20131008
-- The CXX compiler identification is GNU 4.4.7
-- Check for working C compiler: /mnt/apps/intel/composer_xe_2013_sp1.1.106/bin/intel64/icc
-- Check for working C compiler: /mnt/apps/intel/composer_xe_2013_sp1.1.106/bin/intel64/icc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- User set explicit MKL flag which is passed to the compiler and linker: -mkl=paralell
-- This disables math detection and builtin math libraries
-- Setting -DHAVE_MKL_BLAS and -DHAVE_MKL_LAPACK
-- Configuring done
-- Generating done
-- Build files have been written to: /home/milias/Work/qch/software/software_projects/autocmake_devel/autocmake_miroi/test/cc_cblas/build_icc_mkl
configure step is done
now you need to compile the sources:
$ cd build_icc_mkl
$ make
milias@login.grid.umb.sk:~/Work/qch/software/software_projects/autocmake_devel/autocmake_miroi/test/cc_cblas/.cd build_icc_mkl/
milias@login.grid.umb.sk:~/Work/qch/software/software_projects/autocmake_devel/autocmake_miroi/test/cc_cblas/build_icc_mkl/.m
make: Warning: File `Makefile' has modification time 25 s in the future
make[1]: Warning: File `CMakeFiles/Makefile2' has modification time 25 s in the future
make[2]: Warning: File `src/CMakeFiles/example.dir/flags.make' has modification time 25 s in the future
Scanning dependencies of target example
make[2]: warning: Clock skew detected. Your build may be incomplete.
make[2]: Warning: File `src/CMakeFiles/example.dir/flags.make' has modification time 25 s in the future
[100%] Building C object src/CMakeFiles/example.dir/example.c.o
Using Intel MKL <mkl_cblas.h> interface
Linking C executable ../bin/example
icc: command line warning #10159: invalid argument for option '-m'
CMakeFiles/example.dir/example.c.o: In function `main':
/home/milias/Work/qch/software/software_projects/autocmake_devel/autocmake_miroi/test/cc_cblas/src/example.c:(.text+0x241): undefined reference to `cblas_dgemm'
make[2]: *** [bin/example] Error 1
make[1]: *** [src/CMakeFiles/example.dir/all] Error 2
make: *** [all] Error 2
milias@login.grid.umb.sk:~/Work/qch/software/software_projects/autocmake_devel/autocmake_miroi/test/cc_cblas/build_icc_mkl/.
The generated linking flag (test/cc_cblas/build_icc_mkl/src/CMakeFiles/example.dir/link.txt) is:
/mnt/apps/intel/composer_xe_2013_sp1.1.106/bin/intel64/icc -O3 -DNDEBUG -mkl=paralell CMakeFiles/example.dir/example.c.o -o ../bin/example -rdynamic
Found manual solution for the problem above ( https://github.com/scisoft/autocmake/issues/102#issuecomment-138005965 ) - must link selected MKL libraries manually:
milias@login.grid.umb.sk:~/Work/qch/software/software_projects/autocmake_devel/autocmake_miroi/test/cc_cblas/build_icc_mkl/.icc -D HAVE_MKL_BLAS -mkl=paralell ../src/example.c -L/mnt/apps/intel/mkl/lib/intel64 -lmkl_core -lmkl_intel_lp64 -lmkl_blas95_lp64 -lmkl_blacs_lp64 -lmkl_intel_thread -openmp
icc: command line warning #10159: invalid argument for option '-m'
Using Intel MKL <mkl_cblas.h> interface
milias@login.grid.umb.sk:~/Work/qch/software/software_projects/autocmake_devel/autocmake_miroi/test/cc_cblas/build_icc_mkl/.ldd a.out
linux-vdso.so.1 => (0x00007fff553e2000)
libmkl_core.so => /mnt/apps/intel/composer_xe_2013_sp1.1.106/mkl/lib/intel64/libmkl_core.so (0x00007f1188131000)
libmkl_intel_lp64.so => /mnt/apps/intel/composer_xe_2013_sp1.1.106/mkl/lib/intel64/libmkl_intel_lp64.so (0x00007f11879ec000)
libmkl_intel_thread.so => /mnt/apps/intel/composer_xe_2013_sp1.1.106/mkl/lib/intel64/libmkl_intel_thread.so (0x00007f1186a2e000)
libm.so.6 => /lib64/libm.so.6 (0x00007f1186792000)
libiomp5.so => /mnt/apps/intel/composer_xe_2013_sp1.1.106/compiler/lib/intel64/libiomp5.so (0x00007f1186476000)
libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f1186260000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f1186043000)
libc.so.6 => /lib64/libc.so.6 (0x00007f1185cae000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007f1185aaa000)
/lib64/ld-linux-x86-64.so.2 (0x00007f11897f0000)
milias@login.grid.umb.sk:~/Work/qch/software/software_projects/autocmake_devel/autocmake_miroi/test/cc_cblas/build_icc_mkl/.a.out
PASSEDmilias@login.grid.umb.sk:~/Work/qch/software/software_projects/autocmake_devel/autocmake_miroi/test/cc_cblas/build_icc_mkl/.
Closing this. Current math detection is deprecated and will be soon replaced by individual plug-ins. We need to track and debug it there if the problem still persists.
Contrary to the fc_lapack test, where ifort/MKL works, the icc/MKL of the _ccclapack test does not find the LAPACK library.
Fix has be done in the _mathlibs.cmake module.
The same problem for the cc_cblas test: