<?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 in the case if &amp;quot; vsSub in Intel® oneAPI Math Kernel Library</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/MKL-crashes-in-mkl-vml-kernel-sSub/m-p/951498#M15262</link>
    <description>&lt;P&gt;in the case if "&lt;SPAN style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; line-height: 14.399999618530273px;"&gt;&amp;nbsp;vsSub example, and it runs fine and produces the expected result.", then please give us the comprehensive test whci can be compiled and executed on our side to check the problem.&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 08 Jan 2014 13:46:23 GMT</pubDate>
    <dc:creator>Gennady_F_Intel</dc:creator>
    <dc:date>2014-01-08T13:46:23Z</dc:date>
    <item>
      <title>MKL crashes in mkl_vml_kernel_sSub</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/MKL-crashes-in-mkl-vml-kernel-sSub/m-p/951494#M15258</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I'm porting a Windows C/C++ application that uses MKL to the Macintosh, and am running into a crash almost immediately.&lt;/P&gt;

&lt;P&gt;The call I'm doing is this:&lt;/P&gt;

&lt;P&gt;vsSub(&amp;amp;len, src1, src2, dest);&lt;/P&gt;

&lt;P&gt;, where len is declared as int, src1, src2 and dest are declared as float*.&lt;/P&gt;

&lt;P&gt;What happens is that my application crashes on EXC_BAD_ACCESS in mkl_vml_sSub. The exact same code executes and behaves well on Windows.&lt;/P&gt;

&lt;P&gt;I've linked the single library (-lmkl_rt) version, and am using XCode 4.6 with LLVM GCC 4.2. I have tried linking the static libraries, the dynamic libraries and both in the threaded and non-threaded versions. I have also tried explicitly switching off threading via environment variables.&lt;/P&gt;

&lt;P&gt;I compile with the "Use Open MP" flag set to "yes" in all parts of my application, and my application consists of a number of statically linked libraries plus some 3rd party libraries and .dylibs, including Qt.&lt;/P&gt;

&lt;P&gt;My guess is that I've missed something in the configuration or linking of the MKL library, but does anyone know what that may be?&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jan 2014 15:31:51 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/MKL-crashes-in-mkl-vml-kernel-sSub/m-p/951494#M15258</guid>
      <dc:creator>Mats_S_</dc:creator>
      <dc:date>2014-01-07T15:31:51Z</dc:date>
    </item>
    <item>
      <title>Hi mats, </title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/MKL-crashes-in-mkl-vml-kernel-sSub/m-p/951495#M15259</link>
      <description>&lt;P&gt;Hi mats,&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Could you please attach a small test code and &amp;nbsp;let us know more details about your OS, MKL version etc?&amp;nbsp;&lt;/P&gt;

&lt;P&gt;I just try the vsSub.cpp&amp;nbsp;in mkl example under MKL install directory on our lab machine with 10.8.4. &amp;nbsp;It looks everything is fine.&lt;/P&gt;

&lt;P&gt;&amp;gt;&amp;nbsp;bash-3.2$ cat source/vssub.c&lt;/P&gt;

&lt;P&gt;&amp;gt;gcc &amp;nbsp;-w -m64 -I/opt/intel/composer_xe_2013_sp1.1.103/mkl/include source/vssub.c -L/opt/intel/composer_xe_2013_sp1.1.103/mkl/lib -lmkl_rt&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 1em; line-height: 1.5;"&gt;&amp;gt;export DYLD_LIBRARY_PATH="/opt/intel/composer_xe_2013_sp1.1.103/mkl/lib"::"/opt/intel/composer_xe_2013_sp1.1.103/mkl/../compiler/lib"&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;macmini01:vmlc yhu5$ ./a.out&lt;BR /&gt;
	vsSub test/example program&lt;/P&gt;

&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Arguments &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; vsSub&lt;BR /&gt;
	===============================================================================&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; -10000.00000000000000 &amp;nbsp; &amp;nbsp; -10000.00000000000000 &amp;nbsp; &amp;nbsp; &amp;nbsp;0.00000000000000e+00&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp;-7777.77783203125000 &amp;nbsp; &amp;nbsp; &amp;nbsp;-7777.77783203125000 &amp;nbsp; &amp;nbsp; &amp;nbsp;0.00000000000000e+00&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp;-5555.55566406250000 &amp;nbsp; &amp;nbsp; &amp;nbsp;-5555.55566406250000 &amp;nbsp; &amp;nbsp; &amp;nbsp;0.00000000000000e+00&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp;-3333.33325195312500 &amp;nbsp; &amp;nbsp; &amp;nbsp;-3333.33325195312500 &amp;nbsp; &amp;nbsp; &amp;nbsp;0.00000000000000e+00&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp;-1111.11108398437500 &amp;nbsp; &amp;nbsp; &amp;nbsp;-1111.11108398437500 &amp;nbsp; &amp;nbsp; &amp;nbsp;0.00000000000000e+00&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; 1111.11108398437500 &amp;nbsp; &amp;nbsp; &amp;nbsp; 1111.11108398437500 &amp;nbsp; &amp;nbsp; &amp;nbsp;0.00000000000000e+00&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; 3333.33325195312500 &amp;nbsp; &amp;nbsp; &amp;nbsp; 3333.33325195312500 &amp;nbsp; &amp;nbsp; &amp;nbsp;0.00000000000000e+00&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; 5555.55566406250000 &amp;nbsp; &amp;nbsp; &amp;nbsp; 5555.55566406250000 &amp;nbsp; &amp;nbsp; &amp;nbsp;0.00000000000000e+00&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; 7777.77783203125000 &amp;nbsp; &amp;nbsp; &amp;nbsp; 7777.77783203125000 &amp;nbsp; &amp;nbsp; &amp;nbsp;0.00000000000000e+00&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp;10000.00000000000000 &amp;nbsp; &amp;nbsp; &amp;nbsp;10000.00000000000000 &amp;nbsp; &amp;nbsp; &amp;nbsp;0.00000000000000e+00&lt;/P&gt;

&lt;P&gt;Relative accuracy is 0.0000000000000000&lt;/P&gt;

&lt;P&gt;&lt;BR /&gt;
&lt;/P&gt;

&lt;P&gt;#include &amp;lt;stdio.h&amp;gt;&lt;BR /&gt;
	#include "mkl_vml.h"&lt;/P&gt;

&lt;P&gt;#include "_rms.h"&lt;/P&gt;

&lt;P&gt;int main()&lt;BR /&gt;
	{&lt;BR /&gt;
	&amp;nbsp; float fA[10],fB[10];&lt;BR /&gt;
	&amp;nbsp; float fBha0[10],fBha1[10],fBha2[10];&lt;BR /&gt;
	&amp;nbsp; float &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; fBla1[10],fBla2[10];&lt;BR /&gt;
	&amp;nbsp; float &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; fBep1[10],fBep2[10];&lt;BR /&gt;
	&amp;nbsp; float CurRMS,MaxRMS=0.0;&lt;/P&gt;

&lt;P&gt;&amp;nbsp; MKL_INT i=0,vec_len=10;&lt;/P&gt;

&lt;P&gt;&amp;nbsp; fA[0]=-10000.0000;&lt;BR /&gt;
	&amp;nbsp; fA[1]=-7777.7778;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;vsSub(vec_len,fA,fA,fBha0);&lt;/P&gt;

&lt;P&gt;&amp;nbsp; vmsSub(vec_len,fA,fA,fBep1,VML_EP);&lt;/P&gt;

&lt;P&gt;&amp;nbsp; vmlSetMode(VML_EP);&lt;BR /&gt;
	&amp;nbsp; vsSub(vec_len,fA,fA,fBep2);&lt;/P&gt;

&lt;P&gt;}&lt;/P&gt;

&lt;P&gt;macmini01:vmlc yhu5$ more /System/Library/CoreServices/SystemVersion.plist&lt;BR /&gt;
	&amp;lt;?xml version="1.0" encoding="UTF-8"?&amp;gt;&lt;BR /&gt;
	&amp;lt;!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"&amp;gt;&lt;BR /&gt;
	&amp;lt;plist version="1.0"&amp;gt;&lt;BR /&gt;
	&amp;lt;dict&amp;gt;&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;key&amp;gt;ProductBuildVersion&amp;lt;/key&amp;gt;&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;string&amp;gt;12E55&amp;lt;/string&amp;gt;&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;key&amp;gt;ProductCopyright&amp;lt;/key&amp;gt;&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;string&amp;gt;1983-2013 Apple Inc.&amp;lt;/string&amp;gt;&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;key&amp;gt;ProductName&amp;lt;/key&amp;gt;&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;string&amp;gt;Mac OS X&amp;lt;/string&amp;gt;&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;key&amp;gt;ProductUserVisibleVersion&amp;lt;/key&amp;gt;&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;string&amp;gt;10.8.4&amp;lt;/string&amp;gt;&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;key&amp;gt;ProductVersion&amp;lt;/key&amp;gt;&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;string&amp;gt;10.8.4&amp;lt;/string&amp;gt;&lt;BR /&gt;
	&amp;lt;/dict&amp;gt;&lt;BR /&gt;
	&amp;lt;/plist&amp;gt;&lt;BR /&gt;
&lt;/P&gt;

&lt;P&gt;macmini01:vmlc yhu5$ system_profiler|grep Processor&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; Processor Name: Intel Core i7&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; Processor Speed: 2 GHz&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; Number of Processors: 1&lt;BR /&gt;
&lt;/P&gt;</description>
      <pubDate>Wed, 08 Jan 2014 08:53:59 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/MKL-crashes-in-mkl-vml-kernel-sSub/m-p/951495#M15259</guid>
      <dc:creator>Ying_H_Intel</dc:creator>
      <dc:date>2014-01-08T08:53:59Z</dc:date>
    </item>
    <item>
      <title>OS version: Mac OS X 10.8.5</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/MKL-crashes-in-mkl-vml-kernel-sSub/m-p/951496#M15260</link>
      <description>&lt;P&gt;Accidental double-post removed.&lt;/P&gt;</description>
      <pubDate>Wed, 08 Jan 2014 11:45:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/MKL-crashes-in-mkl-vml-kernel-sSub/m-p/951496#M15260</guid>
      <dc:creator>Mats_S_</dc:creator>
      <dc:date>2014-01-08T11:45:00Z</dc:date>
    </item>
    <item>
      <title>OS version: Mac OS X 10.8.5</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/MKL-crashes-in-mkl-vml-kernel-sSub/m-p/951497#M15261</link>
      <description>&lt;P&gt;OS version: Mac OS X 10.8.5&lt;/P&gt;

&lt;P&gt;MKL version: Composer XE 2013 SP 1.103&lt;/P&gt;

&lt;P&gt;&amp;nbsp;Compiler: XCode with LLVM GCC 4.2&lt;/P&gt;

&lt;P&gt;Processor: Intel Core i7, 2GHz, 1 processor (MacBook Air)&lt;/P&gt;

&lt;P&gt;The code that executes is the end of a normalization kernel that subtracts the mean mu (which is in a vector) from the columns of a matrix and places the result in another matrix:&lt;/P&gt;

&lt;P&gt;~&amp;nbsp;&amp;nbsp;for(int j = 0; j &amp;lt; A.width(); ++j)&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;sub_(A.height(), &amp;amp;A(0,j), &amp;amp;mu(0,0), &amp;amp;B(0,j));&lt;/P&gt;

&lt;P&gt;The sub_() function interfaces to vssub:&lt;/P&gt;

&lt;P&gt;~static inline void sub_(int len, const float* src1, const float* src2, float* dest)&lt;BR /&gt;
	{&lt;BR /&gt;
	&amp;nbsp;::vssub(&amp;amp;len, src1, src2, dest);&lt;BR /&gt;
	}&lt;/P&gt;

&lt;P&gt;The matrix class is our own, and it uses MKL_alloc()/MKL_free() for the memory management. Again, the code runs fine in Windows since several years, but on the mac it crashes on one of the vmovups here:&lt;/P&gt;

&lt;P&gt;~~0x1008326d6:&amp;nbsp; jl&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x100832acc&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ; mkl_vml_kernel_sSub_E9HAynn + 1164&lt;BR /&gt;
	0x1008326dc:&amp;nbsp; movl&amp;nbsp;&amp;nbsp; %ebx, %edx&lt;BR /&gt;
	0x1008326de:&amp;nbsp; andl&amp;nbsp;&amp;nbsp; $-32, %edx&lt;BR /&gt;
	0x1008326e1:&amp;nbsp; movslq %edx, %rax&lt;BR /&gt;
	0x1008326e4:&amp;nbsp; xorl&amp;nbsp;&amp;nbsp; %ecx, %ecx&lt;BR /&gt;
	0x1008326e6:&amp;nbsp; vmovups(%r12,%rcx,4), %xmm0&lt;BR /&gt;
	0x1008326ec:&amp;nbsp; vmovups16(%r12,%rcx,4), %xmm2&lt;BR /&gt;
	0x1008326f3:&amp;nbsp; vmovups32(%r12,%rcx,4), %xmm4&lt;BR /&gt;
	0x1008326fa:&amp;nbsp; vmovups48(%r12,%rcx,4), %xmm6&lt;BR /&gt;
	0x100832701:&amp;nbsp; vmovups64(%r12,%rcx,4), %xmm8&lt;BR /&gt;
	0x100832708:&amp;nbsp; vmovups80(%r12,%rcx,4), %xmm10&lt;BR /&gt;
	0x10083270f:&amp;nbsp; vmovups96(%r12,%rcx,4), %xmm12&lt;BR /&gt;
	0x100832716:&amp;nbsp; vmovups112(%r12,%rcx,4), %xmm14&lt;/P&gt;

&lt;P&gt;Which of the instructions it crashes on seems to be dependent on the size of the matrix I'm working on.&lt;/P&gt;

&lt;P&gt;A typical crash:&lt;/P&gt;

&lt;P&gt;Error message: "Thread 1: EXC_BAD_ACCESS (code = 1, address=0x10dfaa000)"&lt;/P&gt;

&lt;P&gt;Crash on the vmovups64 instruction.&lt;/P&gt;

&lt;P&gt;r12 contains 10dea9040, which is consistent with the start of the data for matrix A (containing 512 x 512 floats)&lt;/P&gt;

&lt;P&gt;As a side note, 0x10dfaa000 is not near any of the data owned by the involved matrices A, mu or B.&lt;/P&gt;

&lt;P&gt;I have tried running the vsSub example, and it runs fine and produces the expected result.&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Jan 2014 11:45:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/MKL-crashes-in-mkl-vml-kernel-sSub/m-p/951497#M15261</guid>
      <dc:creator>Mats_S_</dc:creator>
      <dc:date>2014-01-08T11:45:00Z</dc:date>
    </item>
    <item>
      <title>in the case if " vsSub</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/MKL-crashes-in-mkl-vml-kernel-sSub/m-p/951498#M15262</link>
      <description>&lt;P&gt;in the case if "&lt;SPAN style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; line-height: 14.399999618530273px;"&gt;&amp;nbsp;vsSub example, and it runs fine and produces the expected result.", then please give us the comprehensive test whci can be compiled and executed on our side to check the problem.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Jan 2014 13:46:23 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/MKL-crashes-in-mkl-vml-kernel-sSub/m-p/951498#M15262</guid>
      <dc:creator>Gennady_F_Intel</dc:creator>
      <dc:date>2014-01-08T13:46:23Z</dc:date>
    </item>
    <item>
      <title>Hi,</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/MKL-crashes-in-mkl-vml-kernel-sSub/m-p/951499#M15263</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I found the problem. It appears that the gcc compiler "helpfully" directs me to a version of vsSub that has the signature (int, float*, float* , float*) even when I call it with an int* as first argument. Removing the "&amp;amp;" in our own, inlined wrapper function fixed it:&lt;/P&gt;

&lt;P&gt;~~~static inline void sub_(int len, const float* src1, const float* src2, float* dest)&lt;BR /&gt;
	&amp;nbsp;{&lt;BR /&gt;
	&amp;nbsp; ::vssub(len, src1, src2, dest);&lt;BR /&gt;
	&amp;nbsp;}&lt;/P&gt;

&lt;P&gt;The same problem showed itself with the other vml functions later on in the code.&lt;/P&gt;

&lt;P&gt;I found this by stepping the assembly code inside the vml kernel and realizing it was comparing a loop variable to a ginormous number, reminiscent of what could be a pointer.&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Jan 2014 14:19:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/MKL-crashes-in-mkl-vml-kernel-sSub/m-p/951499#M15263</guid>
      <dc:creator>Mats_S_</dc:creator>
      <dc:date>2014-01-08T14:19:00Z</dc:date>
    </item>
  </channel>
</rss>

