<?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 Using Boost.Align and Boost.Numeric.uBlas with Intel MKL  in Intel® oneAPI Math Kernel Library</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Using-Boost-Align-and-Boost-Numeric-uBlas-with-Intel-MKL/m-p/1008732#M19134</link>
    <description>&lt;P&gt;&lt;SPAN style="font-size: 1em;"&gt;Hello everybody,&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;for my project I need to call some basic BLAS routines from the Intel MKL library like gemm or syev. For convenience I wrote my own matrix class whose functions wrap around the BLAS function calls from the MKL library. Since I already use some components of the Boost library, I would like to replace my matrix class with the boost::numeric::ublas::matrix class.&lt;/P&gt;

&lt;P&gt;Till now the underlying storage of my own matrix class is a std::unique_ptr whose data is allocated with mkl_malloc(..., 64) and has a custom deleter&lt;/P&gt;

&lt;P&gt;template&amp;lt;typename T&amp;gt; struct Mkl_deleter { void operator()(T* p) { mkl_free(p); } };&lt;/P&gt;

&lt;P&gt;to ensure the alignment to 64-Byte boundaries in order to maximize performance of the MKL routines. The ublas::matrix class allows to specify an allocator. Hence my idea is to use the boost::align::alined_allocator with 64-Byte alignment for the ublas::matrix class in order to maximize the performance of the MKL routines. Is this a good approach ? Does this yield the desired behavior ? Are there any &amp;nbsp;performance drawbacks ?&lt;/P&gt;

&lt;P&gt;Best regards,&lt;/P&gt;

&lt;P&gt;Felix Kaiser&lt;/P&gt;</description>
    <pubDate>Thu, 08 Oct 2015 08:29:50 GMT</pubDate>
    <dc:creator>Felix__K_</dc:creator>
    <dc:date>2015-10-08T08:29:50Z</dc:date>
    <item>
      <title>Using Boost.Align and Boost.Numeric.uBlas with Intel MKL</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Using-Boost-Align-and-Boost-Numeric-uBlas-with-Intel-MKL/m-p/1008732#M19134</link>
      <description>&lt;P&gt;&lt;SPAN style="font-size: 1em;"&gt;Hello everybody,&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;for my project I need to call some basic BLAS routines from the Intel MKL library like gemm or syev. For convenience I wrote my own matrix class whose functions wrap around the BLAS function calls from the MKL library. Since I already use some components of the Boost library, I would like to replace my matrix class with the boost::numeric::ublas::matrix class.&lt;/P&gt;

&lt;P&gt;Till now the underlying storage of my own matrix class is a std::unique_ptr whose data is allocated with mkl_malloc(..., 64) and has a custom deleter&lt;/P&gt;

&lt;P&gt;template&amp;lt;typename T&amp;gt; struct Mkl_deleter { void operator()(T* p) { mkl_free(p); } };&lt;/P&gt;

&lt;P&gt;to ensure the alignment to 64-Byte boundaries in order to maximize performance of the MKL routines. The ublas::matrix class allows to specify an allocator. Hence my idea is to use the boost::align::alined_allocator with 64-Byte alignment for the ublas::matrix class in order to maximize the performance of the MKL routines. Is this a good approach ? Does this yield the desired behavior ? Are there any &amp;nbsp;performance drawbacks ?&lt;/P&gt;

&lt;P&gt;Best regards,&lt;/P&gt;

&lt;P&gt;Felix Kaiser&lt;/P&gt;</description>
      <pubDate>Thu, 08 Oct 2015 08:29:50 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Using-Boost-Align-and-Boost-Numeric-uBlas-with-Intel-MKL/m-p/1008732#M19134</guid>
      <dc:creator>Felix__K_</dc:creator>
      <dc:date>2015-10-08T08:29:50Z</dc:date>
    </item>
    <item>
      <title>Hi Felix, </title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Using-Boost-Align-and-Boost-Numeric-uBlas-with-Intel-MKL/m-p/1008733#M19135</link>
      <description>&lt;P&gt;Hi Felix,&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 1em; line-height: 1.5;"&gt;There is one article talking about use &lt;/SPAN&gt;use Boost* uBLAS with Intel® MKL.&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 1em; line-height: 1.5;"&gt;&lt;A href="https://software.intel.com/en-us/articles/how-to-use-boost-ublas-with-intel-mkl.&amp;nbsp;" target="_blank"&gt;https://software.intel.com/en-us/articles/how-to-use-boost-ublas-with-intel-mkl.&amp;nbsp;&lt;/A&gt;;&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 1em; line-height: 1.5;"&gt;I believe you had known this. &amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 1em; line-height: 1.5;"&gt;Regardto re&lt;/SPAN&gt;&lt;SPAN style="font-size: 12px; line-height: 18px;"&gt;place your matrix class with the boost::numeric::ublas::matrix class and matrix alignment. &amp;nbsp;The function&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="font-size: 12px; line-height: 18px;"&gt;mkl_malloc (*.64) &amp;nbsp;do nothing special things, just allocate more continuous memory space , then return the 64 byte as start address, then use mkl_free to release all memory space. &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 1em; line-height: 1.5;"&gt;int *mallocedMemory = (int *)malloc(size+63);&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;alignedMemory = (int *)(((int)mallocedMemory + 63) &amp;amp; ~63);&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 12px; line-height: 18px;"&gt;&amp;nbsp;Given that the ublas::matrix class allows to specify an allocator, &amp;nbsp;if &amp;nbsp;you can modify&amp;nbsp;&amp;nbsp;boost::align::alined_allocator with 64-Byte alignment, &amp;nbsp;then&amp;nbsp; yes, it should be no problem, it does same functionality as mkl_malloc, no drawback.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 12px; line-height: 18px;"&gt;Best Regards,&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 12px; line-height: 18px;"&gt;Ying&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Oct 2015 06:58:08 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Using-Boost-Align-and-Boost-Numeric-uBlas-with-Intel-MKL/m-p/1008733#M19135</guid>
      <dc:creator>Ying_H_Intel</dc:creator>
      <dc:date>2015-10-19T06:58:08Z</dc:date>
    </item>
  </channel>
</rss>

