Makefile: Intel fortran, source files in a folder, and Intel Math Kernel Library

南楼画角 提交于 2019-12-24 06:58:16

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!