<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic What is the mkl linker in Intel® oneAPI Math Kernel Library</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Linking-MKL-with-JNI/m-p/1186094#M29602</link>
    <description>What is the mkl linker adviser?
I actually "fixed" the problem. And by fixed I mean I found a horrible workaround which I should not have to be doing but it works. I used the ldd tool to see which MKL shared libraries the executable requires and then I added these lines to my code:
void *handle  = dlopen("libmkl_core.so", RTLD_LAZY | RTLD_GLOBAL);
void *handle1  = dlopen("libmkl_gnu_thread.so", RTLD_LAZY | RTLD_GLOBAL);
void *handle2  = dlopen("libmkl_intel_lp64.so", RTLD_LAZY | RTLD_GLOBAL);

I would think that this is a JNI loading problem but the ldd tool revealed that my library loads 50 other shared libraries and JNI does not have any trouble loading these. The problem seems to occur only with mkl.</description>
    <pubDate>Thu, 11 Jun 2020 08:53:33 GMT</pubDate>
    <dc:creator>Parsert__Julian</dc:creator>
    <dc:date>2020-06-11T08:53:33Z</dc:date>
    <item>
      <title>Linking MKL with JNI.</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Linking-MKL-with-JNI/m-p/1186092#M29600</link>
      <description>I am using JNI to run a torch function which seems to be using MKL. Note, that I am not using MKL myself but torch does. However, I seem to have trouble with the linking of MKL so I figured someone in here might be able to help me out.
I have created a minimal working example and minimal non working example which can be found here: &lt;A href="https://github.com/jparsert/MinExample" target="_blank"&gt;https://github.com/jparsert/MinExample&lt;/A&gt;

The following error message is what I get:
INTEL MKL ERROR: /opt/intel/mkl/lib/intel64/libmkl_vml_avx2.so: undefined symbol: mkl_lapack_dspevd.
Intel MKL FATAL ERROR: cannot load libmkl_vml_avx2.so or libmkl_vml_def.so.



The Readme goes into a bit of detail and shows how to reproduce the problem. Anyways the core points being:

    1. Everything seems to work fine (compilation and runnning) as long as I stay completely in C++ this is the workingExampleWithoutJNI in the above link.

    2. When I invoke a native function from java that  does simple Torch things that do not require mkl everything also works.

    3. When I invoke a native function from java that uses a torch function that depends on an MKL function (so it seems) I get an INTEL MKL ERROR … undefined symbol: mkl_lapack_dspevd

So basically, when running a native function from JNI the mkl/lapack library seems to not be loaded properly, while when running it with CPP  it seems to work.

I see how this may be more of a JNI problem than a MKL problem but maybe someone has a guess where I may be making a mistake.</description>
      <pubDate>Wed, 10 Jun 2020 12:59:24 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Linking-MKL-with-JNI/m-p/1186092#M29600</guid>
      <dc:creator>Parsert__Julian</dc:creator>
      <dc:date>2020-06-10T12:59:24Z</dc:date>
    </item>
    <item>
      <title>how did you build the case?</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Linking-MKL-with-JNI/m-p/1186093#M29601</link>
      <description>&lt;P&gt;how did you build the case? did you check the mkl linker adviser first?&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jun 2020 07:28:45 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Linking-MKL-with-JNI/m-p/1186093#M29601</guid>
      <dc:creator>Gennady_F_Intel</dc:creator>
      <dc:date>2020-06-11T07:28:45Z</dc:date>
    </item>
    <item>
      <title>What is the mkl linker</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Linking-MKL-with-JNI/m-p/1186094#M29602</link>
      <description>What is the mkl linker adviser?
I actually "fixed" the problem. And by fixed I mean I found a horrible workaround which I should not have to be doing but it works. I used the ldd tool to see which MKL shared libraries the executable requires and then I added these lines to my code:
void *handle  = dlopen("libmkl_core.so", RTLD_LAZY | RTLD_GLOBAL);
void *handle1  = dlopen("libmkl_gnu_thread.so", RTLD_LAZY | RTLD_GLOBAL);
void *handle2  = dlopen("libmkl_intel_lp64.so", RTLD_LAZY | RTLD_GLOBAL);

I would think that this is a JNI loading problem but the ldd tool revealed that my library loads 50 other shared libraries and JNI does not have any trouble loading these. The problem seems to occur only with mkl.</description>
      <pubDate>Thu, 11 Jun 2020 08:53:33 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Linking-MKL-with-JNI/m-p/1186094#M29602</guid>
      <dc:creator>Parsert__Julian</dc:creator>
      <dc:date>2020-06-11T08:53:33Z</dc:date>
    </item>
  </channel>
</rss>

