<?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 Hi Ben, in Intel® oneAPI Math Kernel Library</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Crash-on-exit-after-calling-MKL-VML-functions/m-p/1147571#M26840</link>
    <description>&lt;P&gt;Hi Ben,&lt;/P&gt;

&lt;P&gt;We have found the root cause of the issue in our library. We will fix the problem in the next release.&lt;/P&gt;

&lt;P&gt;Thanks,&lt;/P&gt;

&lt;P&gt;Jingwei&lt;/P&gt;</description>
    <pubDate>Thu, 30 Nov 2017 16:27:16 GMT</pubDate>
    <dc:creator>Jingwei_Z_Intel</dc:creator>
    <dc:date>2017-11-30T16:27:16Z</dc:date>
    <item>
      <title>Crash on exit after calling MKL VML functions</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Crash-on-exit-after-calling-MKL-VML-functions/m-p/1147566#M26835</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;
	I'm experiencing a crash on exit after calling one of MKL VML functions (declared in mkl_vml_functions.h). I'm running on OS X.&lt;/P&gt;

&lt;P&gt;The following flow leads to the crash:&lt;/P&gt;

&lt;OL&gt;
	&lt;LI&gt;My dynamic library &lt;SPAN style="font-size: 13.008px;"&gt;(let's&lt;/SPAN&gt;&lt;SPAN style="font-size: 13.008px;"&gt;&amp;nbsp;name it 'dylib1')&lt;/SPAN&gt; is loaded from an application.&lt;/LI&gt;
	&lt;LI&gt;&lt;SPAN style="font-size: 13.008px;"&gt;dylib1&amp;nbsp;&lt;/SPAN&gt;loads another &lt;SPAN style="font-size: 13.008px;"&gt;dynamic library on run-time using 'dlopen()' (let's&amp;nbsp;name the latter 'dylib2').&lt;/SPAN&gt;&lt;/LI&gt;
	&lt;LI&gt;&lt;SPAN style="font-size: 13.008px;"&gt;&lt;SPAN style="font-size: 13.008px;"&gt;dylib2 loads an&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="font-size: 1em;"&gt;MKL customized dynamic&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="font-size: 13.008px;"&gt;library&lt;/SPAN&gt;&lt;SPAN style="font-size: 1em;"&gt; on load-time.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/LI&gt;
	&lt;LI&gt;dylib2 calls an VML function (for example, 'vsLn()').&lt;/LI&gt;
	&lt;LI&gt;&lt;SPAN style="font-size: 1em;"&gt;When quitting the app, 'dlclose()' is called from dylib1, in order to close dylib2.&lt;/SPAN&gt;&lt;/LI&gt;
	&lt;LI&gt;&lt;SPAN style="font-size: 1em;"&gt;&lt;SPAN style="font-size: 1em;"&gt;A crash is caused by EXC_BAD_ACCESS.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;Few more details:&lt;/P&gt;

&lt;UL&gt;
	&lt;LI&gt;&lt;SPAN style="font-size: 13.008px;"&gt;My MKL code works on both Windows and OS X, but crash happens only under OS X.&lt;/SPAN&gt;&lt;/LI&gt;
	&lt;LI&gt;&lt;SPAN style="font-size: 13.008px;"&gt;&lt;SPAN style="font-size: 13.008px;"&gt;This crash seems to happen only when calling VML functions (for example, 'vsLn()', 'vsSub()' and 'vsAdd()'&lt;/SPAN&gt;&lt;SPAN style="font-size: 13.008px;"&gt;).&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;
		When I tried calling other MKL functions which are not declared in&amp;nbsp;mkl_vml_functions.h (for example, 'cblas_copy()', "DftiCreateDescriptor' and 'MKL_Get_Version_String()') - program did not crash on exit.&lt;/LI&gt;
	&lt;LI&gt;&lt;SPAN style="font-size: 13.008px;"&gt;Furthermore, crash seems to happen only if 'dlclose()' is called for dylib2. If I don't call 'dclose()', crash does not happen.&lt;/SPAN&gt;&lt;/LI&gt;
	&lt;LI&gt;&lt;SPAN style="font-size: 13.008px;"&gt;&lt;SPAN style="font-size: 13.008px;"&gt;Customized MKL dylib was build with version 11.3.4, but I also tried to build it with version 2017.4, and crash still happens.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/LI&gt;
	&lt;LI&gt;&lt;SPAN style="font-size: 13.008px;"&gt;&lt;SPAN style="font-size: 13.008px;"&gt;&lt;SPAN style="font-size: 13.008px;"&gt;dylib1 is a plug-in loaded from the application. I'm not the developer of the application, and therefore I can't exactly know what it does.&lt;BR /&gt;
		I couldn't reproduce the crash with my own application, and therefore not attaching any code to this post.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;&lt;SPAN style="font-size: 13.008px;"&gt;I saw another report in this forum about similar crash under Linux (&lt;/SPAN&gt;&lt;A href="https://software.intel.com/en-us/node/629264" target="_blank"&gt;https://software.intel.com/en-us/node/629264&lt;/A&gt;&lt;SPAN style="font-size: 13.008px;"&gt;), that was fixed in version 2016.2.&lt;BR /&gt;
	My guess is that my problem is also related to thread clean up.&lt;/SPAN&gt;&lt;BR /&gt;
	&lt;BR /&gt;
	Am I doing something wrong? or is it related to some MKL thread cleaning issue?&lt;BR /&gt;
	Please advise and let me know if I can supply further details.&lt;/P&gt;

&lt;P&gt;Thanks a lot,&lt;BR /&gt;
	Ben&lt;/P&gt;</description>
      <pubDate>Thu, 26 Oct 2017 13:55:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Crash-on-exit-after-calling-MKL-VML-functions/m-p/1147566#M26835</guid>
      <dc:creator>Ben_V_1</dc:creator>
      <dc:date>2017-10-26T13:55:00Z</dc:date>
    </item>
    <item>
      <title>&gt;&gt; dylib2 loads an MKL</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Crash-on-exit-after-calling-MKL-VML-functions/m-p/1147567#M26836</link>
      <description>&lt;P&gt;&amp;gt;&amp;gt; dylib2 loads an&amp;nbsp;MKL customized dynamic&amp;nbsp;library on load-time.&lt;/P&gt;

&lt;P&gt;Could you please&amp;nbsp;&lt;SPAN style="font-size: 1em;"&gt;to shed some light into what do you mean by that? How do you do that?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 27 Oct 2017 06:01:32 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Crash-on-exit-after-calling-MKL-VML-functions/m-p/1147567#M26836</guid>
      <dc:creator>Gennady_F_Intel</dc:creator>
      <dc:date>2017-10-27T06:01:32Z</dc:date>
    </item>
    <item>
      <title>I built a custom dynamically</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Crash-on-exit-after-calling-MKL-VML-functions/m-p/1147568#M26837</link>
      <description>&lt;P&gt;I built a custom dynamically linked shared MKL library, since I need to use only some MKL functions in my code.&lt;BR /&gt;
	Customized library is built with the following command:&lt;BR /&gt;
	libuni threading=sequential export=&amp;lt;function list file&amp;gt; name=libmkl_custom&lt;/P&gt;

&lt;P&gt;dylib2 loads&amp;nbsp;&lt;SPAN style="font-size: 13.008px;"&gt;libmkl_custom.dylib on load-time. This is done through linking dylib2 with the following commands:&lt;/SPAN&gt;&lt;BR /&gt;
	-L&amp;lt;&lt;SPAN style="font-size: 13.008px;"&gt;libmkl_custom.dylib path&lt;/SPAN&gt;&amp;gt; -Wl,-rpath,&lt;SPAN style="font-size: 13.008px;"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 13.008px;"&gt;libmkl_custom.dylib path&lt;/SPAN&gt;&lt;SPAN style="font-size: 13.008px;"&gt;&amp;gt;&lt;/SPAN&gt; -lmkl_&lt;SPAN style="font-size: 13.008px;"&gt;custom&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 29 Oct 2017 09:33:54 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Crash-on-exit-after-calling-MKL-VML-functions/m-p/1147568#M26837</guid>
      <dc:creator>Ben_V_1</dc:creator>
      <dc:date>2017-10-29T09:33:54Z</dc:date>
    </item>
    <item>
      <title>Hi Ben,</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Crash-on-exit-after-calling-MKL-VML-functions/m-p/1147569#M26838</link>
      <description>&lt;P&gt;Hi Ben,&lt;/P&gt;

&lt;P&gt;Sorry for my ignorance, what is "libuni" you are talking about? Do you have a small reproducer for the problem.&lt;/P&gt;

&lt;P&gt;Thanks,&lt;/P&gt;

&lt;P&gt;Jingwei&lt;/P&gt;</description>
      <pubDate>Tue, 14 Nov 2017 00:49:24 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Crash-on-exit-after-calling-MKL-VML-functions/m-p/1147569#M26838</guid>
      <dc:creator>Jingwei_Z_Intel</dc:creator>
      <dc:date>2017-11-14T00:49:24Z</dc:date>
    </item>
    <item>
      <title>Hi Jingwei,</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Crash-on-exit-after-calling-MKL-VML-functions/m-p/1147570#M26839</link>
      <description>&lt;P&gt;Hi Jingwei,&lt;BR /&gt;
	Thanks for your response.&lt;/P&gt;

&lt;P&gt;I’ve managed to create a smaller reproducer to this issue. Code is attached to this post.&lt;BR /&gt;
	I created a customized MKL dylib with the following command:&lt;BR /&gt;
	make libuni threading=sequential export=mkl_function_list name=libmkl_custom&lt;BR /&gt;
	(this command is taken from MKL Mac OS X user guide: &lt;A href="https://registrationcenter.intel.com/irc_nas/2690/mkl_userguide_mac.pdf)" target="_blank"&gt;https://registrationcenter.intel.com/irc_nas/2690/mkl_userguide_mac.pdf)&lt;/A&gt;.&lt;/P&gt;

&lt;P&gt;The attached XCode project is compiled to an application, and to a dylib (let's call it dylib1). dylib1 is linked to&amp;nbsp;&lt;BR /&gt;
	the customized MKL dylib.&lt;/P&gt;

&lt;P&gt;This is the application workflow:&lt;BR /&gt;
	1. Application opens a thread, and then calls 'pthread_join()' for this thread.&lt;BR /&gt;
	2. Thread dynamically loads dylib1 (with ‘dlopen()’), and calls its 'TestFunc()' function.&lt;BR /&gt;
	3. 'TestFunc()' function calls a vml function ('vsAdd()').&lt;BR /&gt;
	4. 'TestFunc()' returns, and 'dlclose()' is called for dylib1.&lt;BR /&gt;
	5. Thread returns, and application crashes in 'pthread_join()'.&lt;/P&gt;

&lt;P&gt;Please note that removing the call to 'vsAdd()', eliminates the crash.&lt;BR /&gt;
	Moreover, not calling ‘dlclose()’ also eliminates the crash.&lt;/P&gt;

&lt;P&gt;Bug was reproduced on OS 10.12.6, with MKL version 2018.0.1. Both executable and dylib were compiled with LLVM 9.0.&lt;BR /&gt;
	Please see readme.txt in attached zip for more details.&lt;/P&gt;

&lt;P&gt;Thanks for the support,&lt;BR /&gt;
	Ben&lt;/P&gt;</description>
      <pubDate>Mon, 27 Nov 2017 13:55:13 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Crash-on-exit-after-calling-MKL-VML-functions/m-p/1147570#M26839</guid>
      <dc:creator>Ben_V_1</dc:creator>
      <dc:date>2017-11-27T13:55:13Z</dc:date>
    </item>
    <item>
      <title>Hi Ben,</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Crash-on-exit-after-calling-MKL-VML-functions/m-p/1147571#M26840</link>
      <description>&lt;P&gt;Hi Ben,&lt;/P&gt;

&lt;P&gt;We have found the root cause of the issue in our library. We will fix the problem in the next release.&lt;/P&gt;

&lt;P&gt;Thanks,&lt;/P&gt;

&lt;P&gt;Jingwei&lt;/P&gt;</description>
      <pubDate>Thu, 30 Nov 2017 16:27:16 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Crash-on-exit-after-calling-MKL-VML-functions/m-p/1147571#M26840</guid>
      <dc:creator>Jingwei_Z_Intel</dc:creator>
      <dc:date>2017-11-30T16:27:16Z</dc:date>
    </item>
  </channel>
</rss>

