<?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 Re:Intel MKL Static Link with MATLAB MEX File Problem in Intel® oneAPI Math Kernel Library</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Intel-MKL-Static-Link-with-MATLAB-MEX-File-Problem/m-p/1225039#M30280</link>
    <description>&lt;P&gt;we only could comment that MKL doesn't check if there's already an MKL instance loaded into memory and we even don't validate/tested such an option. &lt;/P&gt;&lt;BR /&gt;</description>
    <pubDate>Tue, 03 Nov 2020 12:47:38 GMT</pubDate>
    <dc:creator>Gennady_F_Intel</dc:creator>
    <dc:date>2020-11-03T12:47:38Z</dc:date>
    <item>
      <title>Intel MKL Static Link with MATLAB MEX File Problem</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Intel-MKL-Static-Link-with-MATLAB-MEX-File-Problem/m-p/1223263#M30241</link>
      <description>&lt;P&gt;Hi, we're currently building our own shared object library in Linux (let's call it 'my_library.so' for convenience).&amp;nbsp; We're using BLAS and LAPACK routines from within our my_library.so file, and are statically linking the Intel MKL (2020.0.1) using the compiler &amp;amp; linker options as recommended by the Intel MKL Link Line Advisor.&amp;nbsp; Everything works fine when we call our my_library.so routines (which then&amp;nbsp; make MKL calls) from a stand-alone binary; however, when we call the same my_library.so routines from a MATLAB MEX file, the MKL is somehow calling into the MKL .so files included with MATLAB.&amp;nbsp; We verified this by two methods:&lt;/P&gt;
&lt;P&gt;1. By calling 'mkl_get_version()': from the standalone binary (via a wrapper call in my_library.so) returns 'Intel(R) Math Kernel Library Version 2020.0.1 Product Build 20200208 for Intel(R) 64 architecture applications' and from the MATLAB MEX file&amp;nbsp;(via the same wrapper call in the same my_library.so) returns 'Intel(R) Math Kernel Library Version 2019.0.3 Product Build 20190125 for Intel(R) 64 architecture applications'.&amp;nbsp; Again, this is using the exact same my_library.so file for both the standalone binary and the MEX file.&lt;/P&gt;
&lt;P&gt;2. By examining the stack trace when the MEX file crashes in an MKL routine.&amp;nbsp; This is showing the call stack going into MATLAB's MKL .so file.&amp;nbsp; The crashes are likely occurring because MATLAB is using ILP64 and we're using LP64.&lt;/P&gt;
&lt;P&gt;Statically linking the MKL when building my_library.so should prevent Linux's loader from attempting to load any MKL-related .so files, and no&amp;nbsp; MKL .so files show up in ldd output.&amp;nbsp; The only way I can imagine this scenario occurring is if the MKL is using dlopen() or something similar to determine if there's already an MKL instance loaded into memory, and then using it.&amp;nbsp; Is there any way to stop this behavior?&lt;/P&gt;</description>
      <pubDate>Tue, 27 Oct 2020 13:35:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Intel-MKL-Static-Link-with-MATLAB-MEX-File-Problem/m-p/1223263#M30241</guid>
      <dc:creator>S_Rising</dc:creator>
      <dc:date>2020-10-27T13:35:00Z</dc:date>
    </item>
    <item>
      <title>Re: Intel MKL Static Link with MATLAB MEX File Problem</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Intel-MKL-Static-Link-with-MATLAB-MEX-File-Problem/m-p/1223391#M30250</link>
      <description>&lt;P&gt;Update: this is apparently an issue with the linker arguments,&amp;nbsp; not an MKL issue.&amp;nbsp; It's probably compounded by MATLAB possibly using LD_PRELOAD, which is affecting our .so file.&lt;/P&gt;</description>
      <pubDate>Tue, 27 Oct 2020 22:01:39 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Intel-MKL-Static-Link-with-MATLAB-MEX-File-Problem/m-p/1223391#M30250</guid>
      <dc:creator>S_Rising</dc:creator>
      <dc:date>2020-10-27T22:01:39Z</dc:date>
    </item>
    <item>
      <title>Re:Intel MKL Static Link with MATLAB MEX File Problem</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Intel-MKL-Static-Link-with-MATLAB-MEX-File-Problem/m-p/1225039#M30280</link>
      <description>&lt;P&gt;we only could comment that MKL doesn't check if there's already an MKL instance loaded into memory and we even don't validate/tested such an option. &lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 03 Nov 2020 12:47:38 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Intel-MKL-Static-Link-with-MATLAB-MEX-File-Problem/m-p/1225039#M30280</guid>
      <dc:creator>Gennady_F_Intel</dc:creator>
      <dc:date>2020-11-03T12:47:38Z</dc:date>
    </item>
    <item>
      <title>Re:Intel MKL Static Link with MATLAB MEX File Problem</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Intel-MKL-Static-Link-with-MATLAB-MEX-File-Problem/m-p/1228571#M30352</link>
      <description>&lt;P&gt;This issue has been resolved and we will no longer respond to this thread.&amp;nbsp;If you require additional assistance from Intel, please start a new thread.&amp;nbsp;Any further interaction in this thread will be considered community only.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 16 Nov 2020 01:48:19 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Intel-MKL-Static-Link-with-MATLAB-MEX-File-Problem/m-p/1228571#M30352</guid>
      <dc:creator>Gennady_F_Intel</dc:creator>
      <dc:date>2020-11-16T01:48:19Z</dc:date>
    </item>
  </channel>
</rss>

