dev-cafe / autocmake

CMake plugin composer.
http://autocmake.org
BSD 3-Clause "New" or "Revised" License
42 stars 18 forks source link

ifort -mkl=parallel/sequential does not work with static linking #94

Closed miroi closed 9 years ago

miroi commented 9 years ago

Hi experts,

The ifort -static -mkl=parallel does not work together; -mkl=parallel is only for dynamical linking. Tested within fc_blas framework.

Shouldn't we put some stop into setup.py for this case ?

milias@login.grid.umb.sk:~/Work/qch/software/software_projects/autocmake_devel/autocmake_miroi/test/fc_blas/build_ifort_mklpar_static/./mnt/apps/intel/composer_xe_2013_sp1.1.106/bin/intel64/ifort   -static -static-libgcc -static-intel     -mkl=parallel    -O3 src/CMakeFiles/example.dir/example.f90.o  -o bin/example
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../lib64/libpthread.a(libpthread.o): In function `sem_open':
(.text+0x774d): warning: the use of `mktemp' is dangerous, better use `mkstemp'
src/CMakeFiles/example.dir/example.f90.o: In function `MAIN__':
/home/milias/Work/qch/software/software_projects/autocmake_devel/autocmake_miroi/test/fc_blas/src/example.f90:(.text+0x37a): undefined reference to `dgemm_'
bast commented 9 years ago

Are you sure that -mkl=parallel is only for dynamic linking? Is this something that can be fixed or something that cannot be fixed?

miroi commented 9 years ago

Neither -mkl=parallel, nor --mkl=sequential works with the static linking in autocmake. I searched on internet for this issue, and asked on Intel forums - will report later, when I get the response from them.

milias@login.grid.umb.sk:~/Work/qch/software/software_projects/autocmake_devel/autocmake_miroi/test/fc_blas/.python setup.py --fc=ifort --mkl=sequential --static build_ifort_mklseq_static 
FC=ifort cmake -DEXTRA_FCFLAGS="''" -DENABLE_STATIC_LINKING=True -DENABLE_64BIT_INTEGERS=False -DENABLE_BLAS=auto -DENABLE_LAPACK=auto -DMKL_FLAG=sequential -DMATH_LIB_SEARCH_ORDER="MKL;ESSL;ATLAS;ACML;SYSTEM_NATIVE" -DBLAS_LANG=Fortran -DLAPACK_LANG=Fortran -DCMAKE_BUILD_TYPE=release -G "Unix Makefiles" None /home/milias/Work/qch/software/software_projects/autocmake_devel/autocmake_miroi/test/fc_blas

-- The C compiler identification is GNU 4.4.7
-- The CXX compiler identification is GNU 4.4.7
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- 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
-- The Fortran compiler identification is Intel
-- Check for working Fortran compiler: /mnt/apps/intel/composer_xe_2013_sp1.1.106/bin/intel64/ifort
-- Check for working Fortran compiler: /mnt/apps/intel/composer_xe_2013_sp1.1.106/bin/intel64/ifort  -- works
-- Detecting Fortran compiler ABI info
-- Detecting Fortran compiler ABI info - done
-- Checking whether /mnt/apps/intel/composer_xe_2013_sp1.1.106/bin/intel64/ifort supports Fortran 90
-- Checking whether /mnt/apps/intel/composer_xe_2013_sp1.1.106/bin/intel64/ifort supports Fortran 90 -- yes
-- User set explicit MKL flag which is passed to the compiler and linker: -mkl=sequential
-- 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/fc_blas/build_ifort_mklseq_static

   configure step is done
   now you need to compile the sources:
   $ cd build_ifort_mklseq_static
   $ make
milias@login.grid.umb.sk:~/Work/qch/software/software_projects/autocmake_devel/autocmake_miroi/test/fc_blas/.cd build_ifort_mklseq_static
milias@login.grid.umb.sk:~/Work/qch/software/software_projects/autocmake_devel/autocmake_miroi/test/fc_blas/build_ifort_mklseq_static/.m
make: Warning: File `Makefile' has modification time 22 s in the future
make[1]: Warning: File `CMakeFiles/Makefile2' has modification time 22 s in the future
make[2]: Warning: File `src/CMakeFiles/example.dir/flags.make' has modification time 22 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 22 s in the future
make[2]: warning:  Clock skew detected.  Your build may be incomplete.
make[2]: Warning: File `src/CMakeFiles/example.dir/flags.make' has modification time 22 s in the future
[100%] Building Fortran object src/CMakeFiles/example.dir/example.f90.o
Linking Fortran executable ../bin/example
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../lib64/libpthread.a(libpthread.o): In function `sem_open':
(.text+0x774d): warning: the use of `mktemp' is dangerous, better use `mkstemp'
CMakeFiles/example.dir/example.f90.o: In function `MAIN__':
/home/milias/Work/qch/software/software_projects/autocmake_devel/autocmake_miroi/test/fc_blas/src/example.f90:(.text+0x37a): undefined reference to `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/fc_blas/.python setup.py --fc=ifort --mkl=parallel --static build_ifort_mklpar_static 
FC=ifort cmake -DEXTRA_FCFLAGS="''" -DENABLE_STATIC_LINKING=True -DENABLE_64BIT_INTEGERS=False -DENABLE_BLAS=auto -DENABLE_LAPACK=auto -DMKL_FLAG=parallel -DMATH_LIB_SEARCH_ORDER="MKL;ESSL;ATLAS;ACML;SYSTEM_NATIVE" -DBLAS_LANG=Fortran -DLAPACK_LANG=Fortran -DCMAKE_BUILD_TYPE=release -G "Unix Makefiles" None /home/milias/Work/qch/software/software_projects/autocmake_devel/autocmake_miroi/test/fc_blas

-- The C compiler identification is GNU 4.4.7
-- The CXX compiler identification is GNU 4.4.7
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- 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
-- The Fortran compiler identification is Intel
-- Check for working Fortran compiler: /mnt/apps/intel/composer_xe_2013_sp1.1.106/bin/intel64/ifort
-- Check for working Fortran compiler: /mnt/apps/intel/composer_xe_2013_sp1.1.106/bin/intel64/ifort  -- works
-- Detecting Fortran compiler ABI info
-- Detecting Fortran compiler ABI info - done
-- Checking whether /mnt/apps/intel/composer_xe_2013_sp1.1.106/bin/intel64/ifort supports Fortran 90
-- Checking whether /mnt/apps/intel/composer_xe_2013_sp1.1.106/bin/intel64/ifort supports Fortran 90 -- yes
-- User set explicit MKL flag which is passed to the compiler and linker: -mkl=parallel
-- 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/fc_blas/build_ifort_mklpar_static

   configure step is done
   now you need to compile the sources:
   $ cd build_ifort_mklpar_static
   $ make
milias@login.grid.umb.sk:~/Work/qch/software/software_projects/autocmake_devel/autocmake_miroi/test/fc_blas/.cd build_ifort_mklpar_static
milias@login.grid.umb.sk:~/Work/qch/software/software_projects/autocmake_devel/autocmake_miroi/test/fc_blas/build_ifort_mklpar_static/.m
make: Warning: File `Makefile' has modification time 23 s in the future
make[1]: Warning: File `CMakeFiles/Makefile2' has modification time 23 s in the future
make[2]: Warning: File `src/CMakeFiles/example.dir/flags.make' has modification time 23 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 23 s in the future
make[2]: warning:  Clock skew detected.  Your build may be incomplete.
make[2]: Warning: File `src/CMakeFiles/example.dir/flags.make' has modification time 23 s in the future
[100%] Building Fortran object src/CMakeFiles/example.dir/example.f90.o
Linking Fortran executable ../bin/example
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../lib64/libpthread.a(libpthread.o): In function `sem_open':
(.text+0x774d): warning: the use of `mktemp' is dangerous, better use `mkstemp'
CMakeFiles/example.dir/example.f90.o: In function `MAIN__':
/home/milias/Work/qch/software/software_projects/autocmake_devel/autocmake_miroi/test/fc_blas/src/example.f90:(.text+0x37a): undefined reference to `dgemm_'
make[2]: *** [bin/example] Error 1
make[1]: *** [src/CMakeFiles/example.dir/all] Error 2
make: *** [all] Error 2
bast commented 9 years ago

Which compiler/math combination actually does work with static linking?

miroi commented 9 years ago

The list of compiler/math combinations working for the static linking can be seen here (look for _static in the build name):

https://testboard.org/cdash/index.php?project=MathLibs-tester&date=2015-08-29

In the list I am missing the ACML library. Also, the openblas library is not tested thoroughly, I think. Some more tuning for mathlibs-tester is to be done.

Comments please ?

bast commented 9 years ago

I am closing this issue because of the work in #133 which will make it not relevant anymore. Static linking will then have to be implemented by the caller/user with a very thin layer.