<?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 and if I don't know the size in Intel® oneAPI Math Kernel Library</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/MKL-ALLOC-in-Fortran-how-to-return-a-double-array/m-p/994957#M18253</link>
    <description>&lt;P&gt;and if I don't know the size of array in advance only during execution...&lt;/P&gt;
&lt;P&gt;is it possible to use alignment in fortran in this case ?&lt;/P&gt;</description>
    <pubDate>Mon, 21 Oct 2013 15:37:44 GMT</pubDate>
    <dc:creator>Vitaliy_F_</dc:creator>
    <dc:date>2013-10-21T15:37:44Z</dc:date>
    <item>
      <title>MKL_ALLOC in Fortran... how to return a double array?</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/MKL-ALLOC-in-Fortran-how-to-return-a-double-array/m-p/994955#M18251</link>
      <description>&lt;P&gt;&lt;/P&gt;
&lt;P&gt;I am trying to do two-dimensional DFTs using the Intel MKL (Math Kernal Library). I can't figure out how to use mkl_alloc to allocate a two-dimensional matrix (a rank two array) in Fortran. The form of mkl_alloc is&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="var"&gt;a_ptr&lt;/SPAN&gt;&lt;SPAN class="delim"&gt;&amp;nbsp;=&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="kwd"&gt;mkl_malloc&lt;/SPAN&gt;&lt;SPAN class="delim"&gt;(&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="var"&gt;alloc_size&lt;/SPAN&gt;&lt;SPAN class="sep"&gt;,&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="var"&gt;alignment&lt;/SPAN&gt;&lt;SPAN class="delim"&gt;&amp;nbsp;)&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="delim"&gt;where, alloc_size is an integer, and a_ptr is a Fortran pointer. &amp;nbsp;Because alloc_size is a single integer, the output a_ptr must be a pointer to an array (a rank one array). &amp;nbsp;I would like to associate the output of mkl_malloc with a rank two array, darray(N1,N2). &amp;nbsp;I cannot (as far as I can tell) equate two pointers that correspond to arrays of different rank. &amp;nbsp;This is really frustrating because I have a lot of code using the form darray(i,j) rather than the form array(i+N1*j).&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;I have considered using the newarray = RESHAPE(oldarray,newdim) function to convert the array dimensions, but I am not aware of any guarantee regarding the alignment of the result.&lt;/P&gt;
&lt;P&gt;I've been banging my head against this for a couple days. &amp;nbsp;Any help would be greatly appreciated.&lt;/P&gt;</description>
      <pubDate>Fri, 28 Sep 2012 02:17:10 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/MKL-ALLOC-in-Fortran-how-to-return-a-double-array/m-p/994955#M18251</guid>
      <dc:creator>Andrew_M_3</dc:creator>
      <dc:date>2012-09-28T02:17:10Z</dc:date>
    </item>
    <item>
      <title>I figured this out on my own.</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/MKL-ALLOC-in-Fortran-how-to-return-a-double-array/m-p/994956#M18252</link>
      <description>I figured this out on my own.  The problem was that I didn't realize that the output from MKL_MALLOC is *not* a standard Fortran pointer, as many versions of the documentation had led me to believe.  Therefore, none of the pointer manipulations I had been trying were working or even giving sensible results.  The output of MKL_MALLOC is a non-standard Fortran Cray pointer.  I wish this had been made more clear.  The following code correctly allocates an aligned, rank two array.

real*8 array
pointer(ptr_to_array,array(n1,n2))
ptr_to_array = MKL_MALLOC(8*n1*n2,64)</description>
      <pubDate>Sat, 29 Sep 2012 00:40:46 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/MKL-ALLOC-in-Fortran-how-to-return-a-double-array/m-p/994956#M18252</guid>
      <dc:creator>Andrew_M_3</dc:creator>
      <dc:date>2012-09-29T00:40:46Z</dc:date>
    </item>
    <item>
      <title>and if I don't know the size</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/MKL-ALLOC-in-Fortran-how-to-return-a-double-array/m-p/994957#M18253</link>
      <description>&lt;P&gt;and if I don't know the size of array in advance only during execution...&lt;/P&gt;
&lt;P&gt;is it possible to use alignment in fortran in this case ?&lt;/P&gt;</description>
      <pubDate>Mon, 21 Oct 2013 15:37:44 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/MKL-ALLOC-in-Fortran-how-to-return-a-double-array/m-p/994957#M18253</guid>
      <dc:creator>Vitaliy_F_</dc:creator>
      <dc:date>2013-10-21T15:37:44Z</dc:date>
    </item>
  </channel>
</rss>

