编译时如何 link 库 scalapack 和 blacs

How to link library scalapack and blacs while compilation

编译fortran代码时,我设置

FCL         = mpiifort -qmkl=sequential
LLIBS      += -L$(MKLROOT)/lib/intel64 -lmkl_scalapack_lp64 -lmkl_blacs_intelmpi_lp64

但是在编译代码的时候,总是links到libmkl_scalapack_lp64.so,而不是libmkl_scalapack_lp64.a。然后出现错误,

ifort: command line warning #10006: ignoring unknown option '-qmkl=sequential'
mpi.o: In function `m_max_d_':
mpi.f90:(.text+0x4b52): undefined reference to `dcopy_'
umco.o: In function `umco_mp_umco_calc_trafo_':
umco.f90:(.text+0x8c30): undefined reference to `dgetrf_'
umco.f90:(.text+0x8c69): undefined reference to `dgetri_'
umco.f90:(.text+0x8dde): undefined reference to `dgetri_'
umco.f90:(.text+0x9911): undefined reference to `dgeev_'
umco.f90:(.text+0x9aa4): undefined reference to `dgeev_'
mathtools.f90:(.text+0x3d08): undefined reference to `zgesdd_'
In function `w90_utility_mp_utility_zgemm_new_':
utility.F90:(.text+0x3712): undefined reference to `zgemm_'
/home/app/intel/compilers_and_libraries_2020.0.166/linux/mkl/lib/intel64/libmkl_scalapack_lp64.so: undefined reference to `ssteqr_'
/home/app/intel/compilers_and_libraries_2020.0.166/linux/mkl/lib/intel64/libmkl_scalapack_lp64.so: undefined reference to `dlahqr_'

link这两个库的正确方法是什么?

这在很大程度上取决于您在做什么和编译器版本等。因此,您没有提供足够的细节让我们回答问题。但推荐的方法是使用 Intel link line advisor,它将通过将所有必需的详细信息填写到 Web 表单中来帮助您找到答案。您可以在 https://www.intel.com/content/www/us/en/developer/tools/oneapi/onemkl-link-line-advisor.html#gs.tephcr

找到它