Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.
7222 Discussions

Linking failure: Intel Fortran + MKL Scalapack

janzz2k
Beginner
1,761 Views
Hi,
I am trying to build a Fortran program that includes calls to the Scalapack library, using the Intel Fortran Compiler 10.1.015 and Intel MKL 10.0.2.018. The platform is an SGI Altix with Intel Itanium 2.0 with SuSE SLES 10 and SGI Propack 5. My effort seems to be failing at the linking stage because the linker seems to be unable to resolve certain BLACS references. Here is an example:

ifort -o ABCp.exe -I/opt/intel/mkl/10.0.2.018/include -L/opt/intel/mkl/10.0.2.018/lib/64 -lmkl /opt/intel/mkl/10.0.2.018/lib/64/libmkl_scalapack.a /opt/intel/mkl/10.0.2.018/lib/64/libmkl_blacs_intelmpi20_lp64.a /opt/intel/mkl/10.0.2.018/lib/64/libmkl_lapack.a -lguide -lmpi -lpthread ABCp.f90
/tmp/iforteWglpS.o: In function `MAIN__':
ABCp.f90:(.text+0x362): undefined reference to `blacs_pinfo_'
ABCp.f90:(.text+0x382): undefined reference to `blacs_get_'
ABCp.f90:(.text+0x3b2): undefined reference to `blacs_gridinit_'
ABCp.f90:(.text+0x3e2): undefined reference to `blacs_gridinfo_'
ABCp.f90:(.text+0x6a2): undefined reference to `numroc_'
ABCp.f90:(.text+0x6d2): undefined reference to `numroc_'
ABCp.f90:(.text+0x17d2): undefined reference to `pdgemm_'
ABCp.f90:(.text+0x1f22): undefined reference to `blacs_gridexit_'
ABCp.f90:(.text+0x1f42): undefined reference to `blacs_exit_'
make: *** [ABCp.exe] Error 1

I have tried different combinations of the library files, but so far nothing has worked. For reference, let me also provide below a snapshot of the MKL lib directory on my machine:

Directory: /opt/intel/mkl/10.0.2.018/lib/64
lib/64> ls
libguide.a libmkl_blacs_sgimpt_ilp64.a libmkl_i2p.so libmkl_scalapack.a
libguide.so libmkl_blacs_sgimpt_lp64.a libmkl_intel_ilp64.a libmkl_scalapack_ilp64.a
libiomp5.a libmkl_cdft.a libmkl_intel_ilp64.so libmkl_scalapack_lp64.a
libiomp5.so libmkl_cdft_core.a libmkl_intel_lp64.a libmkl_sequential.a
libmkl_blacs_ilp64.a libmkl_core.a libmkl_intel_lp64.so libmkl_sequential.so
libmkl_blacs_intelmpi20_ilp64.a libmkl_core.so libmkl_intel_sp2dp.a libmkl.so
libmkl_blacs_intelmpi20_lp64.a libmkl_gf_ilp64.a libmkl_intel_sp2dp.so libmkl_solver.a
libmkl_blacs_intelmpi_ilp64.a libmkl_gf_ilp64.so libmkl_intel_thread.a libmkl_solver_ilp64.a
libmkl_blacs_intelmpi_lp64.a libmkl_gf_lp64.a libmkl_intel_thread.so libmkl_solver_ilp64_sequential.a
libmkl_blacs_lp64.a libmkl_gf_lp64.so libmkl_ipf.a libmkl_solver_lp64.a
libmkl_blacs_openmpi_ilp64.a libmkl_gnu_thread.a libmkl_lapack.a libmkl_solver_lp64_sequential.a
libmkl_blacs_openmpi_lp64.a libmkl_gnu_thread.so libmkl_lapack.so libmkl_vml_i2p.so

Please advise. Thanks in advance for help ...
0 Kudos
1 Reply
TimP
Honored Contributor III
1,761 Views
You may find it easier to begin with a dynamic link (all .so rather than a mix of .a and .so libraries). I would expect you would need also the -lmkl_blacs_lp64 (if you use 32-bit integer arguments; _ilp64 for 64-bit integers). If you are using Intel MPI, it would be better to use mpiifort rather than ifort, and drop the -lmpi, and add the -openmp option rather than -lguide -lpthread.If not Intel MPI, you would need to switch to the blacs mpi library corresponding to your MPI. If you continue with .a libraries, check whether the -Wl,--begin-group .... -Wl,--end-group clauses are recommended around your mkl libraries.
0 Kudos
Reply