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

Inconsistent mkl_link_tool behavior

Matt_Thompson
Novice
490 Views

Intel Gurus,

This is an odd one that I just can't seem to solve. Namely, on a SLES 11 cluster I have access to, I can do:

(1150) $ $MKLROOT/tools/mkl_link_tool -libs --os=lnx --compiler=gnu_f --parallel=no -check_mkl_presence

       Intel(R) Math Kernel Library (Intel(R) MKL) Link Tool v4.4
       ==========================================================

Output
======

Linking line:
 -L/usr/local/intel/2017/compilers_and_libraries_2017.4.196/linux/mkl/lib/intel64 -Wl,--no-as-needed -lmkl_gf_lp64 -lmkl_sequential -lmkl_core -lpthread -lm -ldl

And on a SLES 12 cluster:

(569) $ $MKLROOT/tools/mkl_link_tool -libs --os=lnx --compiler=gnu_f --parallel=no -check_mkl_presence

       Intel(R) Math Kernel Library (Intel(R) MKL) Link Tool v4.4
       ==========================================================

Output
======

Linking line:
 -L/nasa/intel/Compiler/2017.4.196/compilers_and_libraries_2017.4.196/linux/mkl/lib/intel64 -Wl,--no-as-needed -lmkl_gf_lp64 -lmkl_sequential -lmkl_core -lpthread -lm -ldl

Now, on my RHEL7 desktop:

(1075) $ $MKLROOT/tools/mkl_link_tool -libs --os=lnx --compiler=gnu_f --parallel=no -check_mkl_presence

       Intel(R) Math Kernel Library (Intel(R) MKL) Link Tool v4.4
       ==========================================================

Intel(R) MKL is not found in /ford1/local/intel/parallel_studio_xe_2017_composer_edition_for_fortran/compilers_and_libraries_2017.4.196/linux/mkl: include file  is not found. Please set architecture using --arch option or MKLROOT environment correctly

Configuration
=============

OS:                     lnx
Architecture:           intel64
Compiler:               gnu_f
Linking:                dynamic
Interface layer:        lp64
Parallel:               no

So on the RHEL desktop, it fails. And it fails...oddly. The modulefile I use on the desktop to create MKLROOT is the exact same as the one on the SLES 11 cluster except for paths. And MKLROOT is defined similarly on both:

(1152) $ echo $MKLROOT
/usr/local/intel/2017/compilers_and_libraries_2017.4.196/linux/mkl
(1076) $ echo $MKLROOT
/ford1/local/intel/parallel_studio_xe_2017_composer_edition_for_fortran/compilers_and_libraries_2017.4.196/linux/mkl

and MKLROOT is set correctly because I can find $MKLROOT/tools/mkl_link_tool on each...and that seems correct?

And the arch was detected correctly, but even if I add it:

(1077) $ $MKLROOT/tools/mkl_link_tool -libs --os=lnx --compiler=gnu_f --parallel=no --arch=intel64 -check_mkl_presence

       Intel(R) Math Kernel Library (Intel(R) MKL) Link Tool v4.4
       ==========================================================

Intel(R) MKL is not found in /ford1/local/intel/parallel_studio_xe_2017_composer_edition_for_fortran/compilers_and_libraries_2017.4.196/linux/mkl: include file  is not found. Please set architecture using --arch option or MKLROOT environment correctly

Configuration
=============

OS:                     lnx
Architecture:           intel64
Compiler:               gnu_f
Linking:                dynamic
Interface layer:        lp64
Parallel:               no

Now, my hope is that mkl_link_tool was a fun Perl/Python script I could look inside, but no go, it's a compiled program. So, what "include file" is it looking for? It won't tell me (it looks like there is a blank space in the output), so I'm a bit stuck. Perhaps the system admins installed it incorrectly, but as near as I can tell the MKL installation on my desktop is roughly the same as that on the cluster, save the cluster admins installed much more stuff (more FFT, cluster, etc.).

Thanks,

Matt

0 Kudos
5 Replies
Matt_Thompson
Novice
490 Views

Additional. On my colleague's Macbook Pro:

$MKLROOT/tools/mkl_link_tool -libs --os=mac --compiler=intel_f --parallel=no -check_mkl_presence

       Intel(R) Math Kernel Library (Intel(R) MKL) Link Tool v4.5
       ==========================================================

Intel(R) MKL is not found in /opt/intel/compilers_and_libraries_2018.0.104/mac/mkl: include file  is not found. Please set architecture using --arch option or MKLROOT environment correctly

Configuration
=============

OS:                     mac
Architecture:           intel64
Compiler:               intel_f
Linking:                dynamic
Interface layer:        lp64
Parallel:               no

So it does seem to be some "installed on cluster" vs "installed on desktop" issue? Maybe we aren't installing everything correctly?

0 Kudos
Zhen_Z_Intel
Employee
490 Views

Hi Matt,

I can reproduce your problem with 2017.4.196, but not all machines can produce, thus I suppose the link tool may require to check with mkl.h file under $MKLROOT/include when you use -check_mkl_presence option. I am wondering if you installed mkl for c on the RHEL7 ? or just for fortran? Cause if you only installed mkl for fortran, there's no mkl.h. We will also check with script of link tool to find root cause.

Currently, you may could try to remove -check_mkl_presence to avoid error message.

Best regards,
Fiona

0 Kudos
Matt_Thompson
Novice
490 Views

Fiona,

We do not seem to have it. Since we only have a license for Intel Fortran, it's possible the sysadmins don't install MKL for C...or are they allowed to? I'll talk with them. I've never installed Intel Fortran outside of Betas, and then I usually just say "give me everything" so I get things like TBB which I've never used!

As for the removal of -check_mkl_presence, I technically can't because of make. If I remove it I get:

(102) $ $MKLROOT/tools/mkl_link_tool -libs --os=lnx --compiler=gnu_f --parallel=no --arch=intel64

       Intel(R) Math Kernel Library (Intel(R) MKL) Link Tool v4.4
       ==========================================================

Output
======

Linking line:
 -L$(MKLROOT)/lib/intel64 -Wl,--no-as-needed -lmkl_gf_lp64 -lmkl_sequential -lmkl_core -lpthread -lm -ldl

But, I read that through a makefile with:

  ifdef MKLROOT
     ifeq ($(wildcard $(MKLROOT)/tools/mkl_link_tool),$(MKLROOT)/tools/mkl_link_tool)
        LIB_SCI = $(shell $(MKLROOT)/tools/mkl_link_tool -libs --os=$(MKL_OS) --compiler=$(MKL_COMPILER) --parallel=no -check_mkl_presence)
     endif
  else

The issue is that the shell tries to resolve the $(MKLROOT). /bin/sh might know $MKLROOT, but not $(MKLROOT) so when I try to echo out LIB_SCI:

/bin/sh: MKLROOT: command not found
         LIB_SCI =  -L/lib/intel64 -Wl,--no-as-needed -lmkl_gf_lp64 -lmkl_sequential -lmkl_core -lpthread -lm -ldl

The $(MKLROOT) is failed, and the -L is resolved as a null-string.

I was able to hack around it a bit, but I'll talk with my sysadmins.

Any chance mkl_link_tool can failover if mkl.h is not there and look for a Fortran file (mkl.fi, say)?

0 Kudos
Matt_Thompson
Novice
490 Views

I talked with the sysadmins and it looks like "Intel MKL core libraries for C/C++" are not part of the default install for the Parallel Studio Composer Edition for Fortran Linux. It's a custom build.

I'm having them re-install, but it would be nice if mkl_link_tool would play nice with a "just Fortran" install.

0 Kudos
Zhen_Z_Intel
Employee
490 Views

Hi Matt,

The problem has been solved and will target on MKL2018u2, thank you.

Best regards,
Fiona

0 Kudos
Reply