<?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 Copy from one vector to another via an index map using MKL? in Intel® oneAPI Math Kernel Library</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Copy-from-one-vector-to-another-via-an-index-map-using-MKL/m-p/985967#M17757</link>
    <description>&lt;P&gt;Hi, can I utilize MKL (or any other library) for the following operations?&lt;/P&gt;
&lt;P&gt;[cpp]&lt;/P&gt;
&lt;P&gt;for (int i=0; i&amp;lt;N; i++)&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; y&lt;I&gt; = x[map&lt;I&gt;]&lt;/I&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P&gt;[/cpp]&lt;/P&gt;
&lt;P&gt;or&amp;nbsp;&lt;/P&gt;
&lt;P&gt;[cpp]&lt;/P&gt;
&lt;P&gt;for (int i=0; i&amp;lt;N; i++) x[map&lt;I&gt;] += y&lt;I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P&gt;[/cpp]&lt;/P&gt;
&lt;P&gt;The second operation looks impossible to parallelize using SSE or OpenMP, does it?&lt;/P&gt;
&lt;P&gt;Thanks.&lt;/P&gt;</description>
    <pubDate>Fri, 29 Mar 2013 21:36:17 GMT</pubDate>
    <dc:creator>zer0nes</dc:creator>
    <dc:date>2013-03-29T21:36:17Z</dc:date>
    <item>
      <title>Copy from one vector to another via an index map using MKL?</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Copy-from-one-vector-to-another-via-an-index-map-using-MKL/m-p/985967#M17757</link>
      <description>&lt;P&gt;Hi, can I utilize MKL (or any other library) for the following operations?&lt;/P&gt;
&lt;P&gt;[cpp]&lt;/P&gt;
&lt;P&gt;for (int i=0; i&amp;lt;N; i++)&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; y&lt;I&gt; = x[map&lt;I&gt;]&lt;/I&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P&gt;[/cpp]&lt;/P&gt;
&lt;P&gt;or&amp;nbsp;&lt;/P&gt;
&lt;P&gt;[cpp]&lt;/P&gt;
&lt;P&gt;for (int i=0; i&amp;lt;N; i++) x[map&lt;I&gt;] += y&lt;I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P&gt;[/cpp]&lt;/P&gt;
&lt;P&gt;The second operation looks impossible to parallelize using SSE or OpenMP, does it?&lt;/P&gt;
&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Fri, 29 Mar 2013 21:36:17 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Copy-from-one-vector-to-another-via-an-index-map-using-MKL/m-p/985967#M17757</guid>
      <dc:creator>zer0nes</dc:creator>
      <dc:date>2013-03-29T21:36:17Z</dc:date>
    </item>
    <item>
      <title>There are two BLAS level-1</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Copy-from-one-vector-to-another-via-an-index-map-using-MKL/m-p/985968#M17758</link>
      <description>&lt;P&gt;There are two BLAS level-1 functions that are exactly for these purposes: GTHR and ROTI. Please look &lt;A href="http://software.intel.com/sites/products/documentation/doclib/mkl_sa/11/mklman/hh_goto.htm#GUID-01C4A32A-4509-40AA-9431-16BFF6148462.htm"&gt;here &lt;/A&gt;and &lt;A href="http://software.intel.com/sites/products/documentation/doclib/mkl_sa/11/mklman/hh_goto.htm#GUID-A049DC64-EB0F-4B0E-AEB1-A0531E1F80F6.htm"&gt;here&lt;/A&gt;. Both are vectorized and parallelized in MKL.&lt;/P&gt;</description>
      <pubDate>Fri, 29 Mar 2013 21:59:49 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Copy-from-one-vector-to-another-via-an-index-map-using-MKL/m-p/985968#M17758</guid>
      <dc:creator>Zhang_Z_Intel</dc:creator>
      <dc:date>2013-03-29T21:59:49Z</dc:date>
    </item>
    <item>
      <title>Thanks!</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Copy-from-one-vector-to-another-via-an-index-map-using-MKL/m-p/985969#M17759</link>
      <description>&lt;P&gt;Thanks!&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;Zhang Z (Intel) wrote:&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;
&lt;P&gt;There are two BLAS level-1 functions that are exactly for these purposes: GTHR and ROTI. Please look &lt;A href="http://software.intel.com/sites/products/documentation/doclib/mkl_sa/11/mklman/hh_goto.htm#GUID-01C4A32A-4509-40AA-9431-16BFF6148462.htm"&gt;here &lt;/A&gt;and &lt;A href="http://software.intel.com/sites/products/documentation/doclib/mkl_sa/11/mklman/hh_goto.htm#GUID-A049DC64-EB0F-4B0E-AEB1-A0531E1F80F6.htm"&gt;here&lt;/A&gt;. Both are vectorized and parallelized in MKL.&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Unfortunately, roti doesn't work in my case because it requires that the values in indx must be distinct. In my case, the first operation is an expansion while the second one is a contraction. My indx has many duplicated values.&lt;/P&gt;</description>
      <pubDate>Fri, 29 Mar 2013 22:37:21 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Copy-from-one-vector-to-another-via-an-index-map-using-MKL/m-p/985969#M17759</guid>
      <dc:creator>zer0nes</dc:creator>
      <dc:date>2013-03-29T22:37:21Z</dc:date>
    </item>
    <item>
      <title>Thanks. </title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Copy-from-one-vector-to-another-via-an-index-map-using-MKL/m-p/985970#M17760</link>
      <description>&lt;P&gt;Thanks.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Unfortunately, ROTI doesn't apply in my case because it requires that indx has unique values. My indx has many duplicated values. Basically, the first operation is an expansion so that BLAS's gemm can be called. The second operation is the reduction.&lt;/P&gt;
&lt;P&gt;It the second operation is not vectorizable, will I be able to utilize MKL if I change the second operation to the following?&lt;/P&gt;
&lt;P&gt;[csharp]&lt;/P&gt;
&lt;P&gt;for (int i=0; i&amp;lt;M; i++) {&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; int[] indices = map&lt;I&gt;; // map is int[][]&lt;/I&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; for (int j=0; j&amp;lt;indices.Length; i++)&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; x&lt;I&gt; += y[indices&lt;J&gt;];&lt;/J&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;[/csharp]&lt;/P&gt;</description>
      <pubDate>Sat, 30 Mar 2013 05:24:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Copy-from-one-vector-to-another-via-an-index-map-using-MKL/m-p/985970#M17760</guid>
      <dc:creator>zer0nes</dc:creator>
      <dc:date>2013-03-30T05:24:00Z</dc:date>
    </item>
    <item>
      <title>As long as you have repeated</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Copy-from-one-vector-to-another-via-an-index-map-using-MKL/m-p/985971#M17761</link>
      <description>&lt;P&gt;As long as you have repeated values in map[], vectorization or parallelization introduces indeterminacy on which of the repeated values takes final effect.&amp;nbsp; If you don't care which of those takes effect, promoting parallelization by the MKL function or by assertions such as #pragma ivdep in your code could be acceptable.&amp;nbsp; The resulting race conditions could restrict the performance gain if there are enough of them.&lt;/P&gt;</description>
      <pubDate>Sat, 30 Mar 2013 16:53:06 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Copy-from-one-vector-to-another-via-an-index-map-using-MKL/m-p/985971#M17761</guid>
      <dc:creator>TimP</dc:creator>
      <dc:date>2013-03-30T16:53:06Z</dc:date>
    </item>
    <item>
      <title>Can I parallelize with MKL</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Copy-from-one-vector-to-another-via-an-index-map-using-MKL/m-p/985972#M17762</link>
      <description>&lt;P&gt;Can I parallelize with MKL for the modified update algorithm?&lt;/P&gt;
&lt;P&gt;[csharp]&lt;/P&gt;
&lt;P&gt;for (int i=0; i&amp;lt;M; i++) { &amp;nbsp; &amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; int[] indices = map&lt;I&gt;; // map is int[][] &amp;nbsp; &amp;nbsp;&lt;/I&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; for (int j=0; j&amp;lt;indices.Length; i++) &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; x&lt;I&gt; += y[indices&lt;J&gt;];&lt;/J&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;[/csharp]&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;TimP (Intel) wrote:&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;
&lt;P&gt;As long as you have repeated values in map[], vectorization or parallelization introduces indeterminacy on which of the repeated values takes final effect.&amp;nbsp; If you don't care which of those takes effect, promoting parallelization by the MKL function or by assertions such as #pragma ivdep in your code could be acceptable.&amp;nbsp; The resulting race conditions could restrict the performance gain if there are enough of them.&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 31 Mar 2013 06:26:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Copy-from-one-vector-to-another-via-an-index-map-using-MKL/m-p/985972#M17762</guid>
      <dc:creator>zer0nes</dc:creator>
      <dc:date>2013-03-31T06:26:00Z</dc:date>
    </item>
    <item>
      <title>There isn't an MKL function</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Copy-from-one-vector-to-another-via-an-index-map-using-MKL/m-p/985973#M17763</link>
      <description>&lt;P&gt;There isn't an MKL function for this (when there are duplicate values in the index vector). But you can use the Intel compiler to vectorize/parallelize your own implementation. For example, you can parallelize the outer loop with OpenMP parallel for, and vectorize the inner loop with #pragma ivdep and other vectorization pragmas. You can check whether your code is successfully vectorized or not by using the "-vector-report" option of Intel compiler. Vectorization is a big topic by itself. There are many things you can do to make your code vectorize better. This page (http://software.intel.com/en-us/intel-vectorization-tools) is the ultimate guide for all you need to know about vectorization with Intel compilers. If you are in a hurry, you can start with this article: &lt;A href="http://software.intel.com/en-us/articles/a-guide-to-auto-vectorization-with-intel-c-compilers/" target="_blank"&gt;http://software.intel.com/en-us/articles/a-guide-to-auto-vectorization-with-intel-c-compilers/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Apr 2013 21:34:27 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Copy-from-one-vector-to-another-via-an-index-map-using-MKL/m-p/985973#M17763</guid>
      <dc:creator>Zhang_Z_Intel</dc:creator>
      <dc:date>2013-04-01T21:34:27Z</dc:date>
    </item>
  </channel>
</rss>

