<?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 Memory errors when calling lapack subroutines  in Intel® oneAPI Math Kernel Library</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Memory-errors-when-calling-lapack-subroutines/m-p/1099174#M23760</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I tried to use SVD subroutines (LAPACKE_sbdsqr, LAPACKE_sbdsdc) in MKL, but encountered memory errors as "null pointer dereference or unaligned memory access". I used mkl_malloc to allocate all memory buffers for all inputs and outputs with alignment of 64 byte, and I'm pretty sure I allocated enough space for all inputs and outputs. Does anybody have idea about what might be wrong?&lt;/P&gt;

&lt;P&gt;Thanks a lot!&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Can&lt;/P&gt;</description>
    <pubDate>Mon, 28 Nov 2016 23:45:16 GMT</pubDate>
    <dc:creator>can_p_</dc:creator>
    <dc:date>2016-11-28T23:45:16Z</dc:date>
    <item>
      <title>Memory errors when calling lapack subroutines</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Memory-errors-when-calling-lapack-subroutines/m-p/1099174#M23760</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I tried to use SVD subroutines (LAPACKE_sbdsqr, LAPACKE_sbdsdc) in MKL, but encountered memory errors as "null pointer dereference or unaligned memory access". I used mkl_malloc to allocate all memory buffers for all inputs and outputs with alignment of 64 byte, and I'm pretty sure I allocated enough space for all inputs and outputs. Does anybody have idea about what might be wrong?&lt;/P&gt;

&lt;P&gt;Thanks a lot!&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Can&lt;/P&gt;</description>
      <pubDate>Mon, 28 Nov 2016 23:45:16 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Memory-errors-when-calling-lapack-subroutines/m-p/1099174#M23760</guid>
      <dc:creator>can_p_</dc:creator>
      <dc:date>2016-11-28T23:45:16Z</dc:date>
    </item>
    <item>
      <title>Hi Can,</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Memory-errors-when-calling-lapack-subroutines/m-p/1099175#M23761</link>
      <description>&lt;P&gt;Hi Can,&lt;/P&gt;

&lt;P&gt;I could not reproduce your problem, there's no problem about NULL/bad pointer for memory allocation on my side by using mkl_malloc, could you please provide a test case or your program that I could have a look. Please also check with your machine if there's enough space for your program. Thanks.&lt;/P&gt;

&lt;P&gt;Best regards,&lt;BR /&gt;
	Fiona&lt;/P&gt;</description>
      <pubDate>Tue, 29 Nov 2016 03:33:33 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Memory-errors-when-calling-lapack-subroutines/m-p/1099175#M23761</guid>
      <dc:creator>Zhen_Z_Intel</dc:creator>
      <dc:date>2016-11-29T03:33:33Z</dc:date>
    </item>
    <item>
      <title>Thank you Fiona for your</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Memory-errors-when-calling-lapack-subroutines/m-p/1099176#M23762</link>
      <description>&lt;P&gt;Thank you Fiona for your reply. Here is a simple program I used to test the subroutine bdsqr&lt;/P&gt;

&lt;P&gt;The link option I used is like&lt;/P&gt;

&lt;P&gt;-Wl,--start-group -L${IMKLHOME}/lib/intel64&amp;nbsp; -lmkl_intel_ilp64 -lmkl_sequential -lpthread\&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -lmkl_core -lmkl_lapack95_ilp64 -Wl,--end-group&lt;/P&gt;

&lt;P&gt;#include "mkl.h"&lt;BR /&gt;
	#include "mkl_lapacke.h"&lt;BR /&gt;
	#include &amp;lt;cstring&amp;gt;&lt;BR /&gt;
	#include &amp;lt;cmath&amp;gt;&lt;BR /&gt;
	#include &amp;lt;algorithm&amp;gt;&lt;/P&gt;

&lt;P&gt;using namespace std;&lt;/P&gt;

&lt;P&gt;int main() {&lt;BR /&gt;
	&amp;nbsp; float *mdiag=(float *) mkl_malloc(4*sizeof(float),64);&lt;BR /&gt;
	&amp;nbsp; float *udiag=(float *) mkl_malloc(4*sizeof(float),64);&lt;BR /&gt;
	&amp;nbsp; float *u=(float *) mkl_malloc(4*4*sizeof(float),64);&lt;BR /&gt;
	&amp;nbsp; float *vt=(float *) mkl_malloc(4*4*sizeof(float),64);&lt;BR /&gt;
	&amp;nbsp; float *c=(float *) mkl_malloc(4*4*sizeof(float),64);&lt;BR /&gt;
	&amp;nbsp; memset(c,0,16*sizeof(float));&lt;BR /&gt;
	&amp;nbsp; for (int i=0;i&amp;lt;4;++i) {&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; mdiag&lt;I&gt;=1;&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; udiag&lt;I&gt;=1;&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; c[i*4+i]=1;&lt;BR /&gt;
	&amp;nbsp; }&lt;/I&gt;&lt;/I&gt;&lt;/P&gt;

&lt;P&gt;&amp;nbsp; int flag=LAPACKE_sbdsqr(LAPACK_COL_MAJOR,'U',4,4,4,4,mdiag,udiag,vt,4,u,4,c,4);&lt;BR /&gt;
	&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp; mkl_free(u);&lt;BR /&gt;
	&amp;nbsp; mkl_free(vt);&lt;BR /&gt;
	&amp;nbsp; mkl_free(mdiag);&lt;BR /&gt;
	&amp;nbsp; mkl_free(udiag);&lt;BR /&gt;
	}&lt;/P&gt;

&lt;P&gt;Is there anything wrong with the linking?&lt;/P&gt;

&lt;P&gt;Thanks,&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Can&lt;/P&gt;</description>
      <pubDate>Tue, 29 Nov 2016 15:46:27 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Memory-errors-when-calling-lapack-subroutines/m-p/1099176#M23762</guid>
      <dc:creator>can_p_</dc:creator>
      <dc:date>2016-11-29T15:46:27Z</dc:date>
    </item>
    <item>
      <title>Hi Can,</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Memory-errors-when-calling-lapack-subroutines/m-p/1099177#M23763</link>
      <description>&lt;P&gt;Hi Can,&lt;/P&gt;

&lt;P&gt;Seems no problem with your code. For your link line, you are going to use 64 integer lib, if so, please also compile with -DMKL_ILP64 option and you could remove lapack95 lib which is used for fortran95 interface.&amp;nbsp;I recommend to use &lt;A href="https://software.intel.com/en-us/articles/intel-mkl-link-line-advisor"&gt;MKL advisor&lt;/A&gt;&amp;nbsp;help to generate your own command. And&amp;nbsp;I also wonder what's the version of MKL &amp;amp; Intel compiler you are using. Have you ever tried to replace mkl_malloc with basic glibc malloc function? What would be like if you just change mkl_malloc to malloc?&lt;/P&gt;

&lt;P&gt;Best regards,&lt;BR /&gt;
	Fiona&lt;/P&gt;</description>
      <pubDate>Wed, 30 Nov 2016 02:25:18 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Memory-errors-when-calling-lapack-subroutines/m-p/1099177#M23763</guid>
      <dc:creator>Zhen_Z_Intel</dc:creator>
      <dc:date>2016-11-30T02:25:18Z</dc:date>
    </item>
    <item>
      <title>Thanks Fiona,</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Memory-errors-when-calling-lapack-subroutines/m-p/1099178#M23764</link>
      <description>&lt;P&gt;Thanks Fiona,&lt;/P&gt;

&lt;P&gt;We found out that for our linux, we should link LP64 libraries instead of ILP64 ones. After changing the linked libraries, everything is fine.&lt;/P&gt;

&lt;P&gt;Thank you again for your help!&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Can&lt;/P&gt;</description>
      <pubDate>Wed, 30 Nov 2016 16:35:33 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Memory-errors-when-calling-lapack-subroutines/m-p/1099178#M23764</guid>
      <dc:creator>can_p_</dc:creator>
      <dc:date>2016-11-30T16:35:33Z</dc:date>
    </item>
  </channel>
</rss>

