问题
I have a main.f90 in the folder /ex. And the f77 subroutine files are in /ex/src. And the subroutine files again use BLAS and LAPACK libraries. For the BLAS and LAPACK, I have to use Intel Math Kernel Library.
The Intel fortran and the mkl folders look like:
/opt/intel$
ActivationTool composer_xe_2011_sp1 intel_sdp_products.db man
bin composer_xe_2011_sp1.11.339 lib mkl
composerxe include licenses
/opt/intel/mkl$
benchmarks bin examples include interfaces lib tests tools
/opt/intel/mkl/lib/ia32$
libmkl_avx.so libmkl_gnu_thread.so libmkl_scalapack_core.so
libmkl_blacs.a libmkl_intel.a libmkl_sequential.a
libmkl_blacs_intelmpi.a libmkl_intel.so libmkl_sequential.so
libmkl_blacs_intelmpi.so libmkl_intel_thread.a libmkl_solver.a
... (a bunch of files) ...
What's the makefile code for the main.f90 in /ex to be compiled? Thanks!
回答1:
I guess you're using version 12 (guess from composer_xe_2011_sp1.11.339
in /opt/intel), so you can simply use -mkl
option when linking like this:
ifort main.o sub1.o sub2.o -o a.out -mkl
(See: http://software.intel.com/en-us/articles/using-mkl-in-intel-compiler-mkl-qmkl-options)
来源:https://stackoverflow.com/questions/12052133/makefile-intel-fortran-source-files-in-a-folder-and-intel-math-kernel-library