<?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 Re: Batched FFT with varying input distance in Intel® oneAPI Math Kernel Library</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Batched-FFT-with-varying-input-distance/m-p/1622881#M36320</link>
    <description>&lt;P&gt;Thanks for the attempt; I suppose I did say any help is appreciated, but it's clear your solution wasn't tested. Setting DFTI_INPUT_DISTANCE to 10240 assumes all transforms are equally spaced by that amount. My case involves varying distances.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You're suggesting that MKL automatically computes the strides and distances for batched dimensions, but if that's the case, how can MKL differentiate between a request for 384 transforms each spaced 10240 apart, and the scenario where input distances vary?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you had actually tried running this instead of just posting what seems like a response from ChatGPT (which, incidentally, is nearly identical to what you wrote), you would have realized it causes a segmentation fault.&lt;/P&gt;</description>
    <pubDate>Tue, 13 Aug 2024 08:55:33 GMT</pubDate>
    <dc:creator>henricryden</dc:creator>
    <dc:date>2024-08-13T08:55:33Z</dc:date>
    <item>
      <title>Batched FFT with varying input distance</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Batched-FFT-with-varying-input-distance/m-p/1622120#M36315</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm switching my fft implementation from fftw to MKL and I'm having trouble setting up batched FFT's with varying input distance. For instance, lets say I have a float array of size [32, 320, 12], strides [1, 32, 10240] and I want to perform 1D FFT along the second dimension. Then this would be my descriptor:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;DftiCreateDescriptor(&amp;amp;plan, DFTI_SINGLE, DFTI_COMPLEX, 1, 320);
std::vector&amp;lt;MKL_LONG&amp;gt; input_strides(4);
input_strides[0] = 0; // MKL convention
input_strides[1] = 1;
input_strides[2] = 32;
input_strides[3] = 10240;
plan_, DFTI_INPUT_STRIDES, input_strides.data());&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The number of transforms (or batches) is 32*12 = 382:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;DftiSetValue(plan, DFTI_NUMBER_OF_TRANSFORMS,  382);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How do I set &lt;A href="https://www.intel.com/content/www/us/en/docs/onemkl/developer-reference-c/2024-2/dfti-input-distance-dfti-output-distance.html" target="_blank" rel="noopener"&gt;DFTI_INPUT_DISTANCE&lt;/A&gt; (as required when &lt;A href="https://www.intel.com/content/www/us/en/docs/onemkl/developer-reference-c/2024-2/dfti-number-of-transforms.html" target="_blank" rel="noopener"&gt;DFTI_NUMBER_OF_TRANSFORMS&lt;/A&gt; &amp;gt; 1)?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In fftw , you specify the size and strides of all batched dimensions&amp;nbsp;(&lt;A href="https://www.fftw.org/fftw3_doc/Guru-Complex-DFTs.html" target="_blank" rel="noopener"&gt;howmany_dims&lt;/A&gt;), but MKL seems to only support a scalar distance?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the example above, the distance varies (12 sub-batches 10240 elements apart, each with 32 FFT's of unit distance 1).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help is appreciated&lt;/P&gt;</description>
      <pubDate>Fri, 09 Aug 2024 12:50:36 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Batched-FFT-with-varying-input-distance/m-p/1622120#M36315</guid>
      <dc:creator>henricryden</dc:creator>
      <dc:date>2024-08-09T12:50:36Z</dc:date>
    </item>
    <item>
      <title>Re:Batched FFT with varying input distance</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Batched-FFT-with-varying-input-distance/m-p/1622838#M36318</link>
      <description>&lt;P&gt;Hi Henric,&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;In MKL, when you have multiple batches of FFTs with varying input distances, you need to set the DFTI_INPUT_DISTANCE configuration parameter to the maximum distance between the start of consecutive input data sets.&lt;/P&gt;&lt;P&gt;In your case, where you have a float array of size [32, 320, 12] with strides [1, 32, 10240], and you want to perform 1D FFTs along the second dimension (size 320) with 32*12 = 384 batches, the maximum input distance would be 10240.&lt;/P&gt;&lt;P&gt;Here's how you can set it up:&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;DftiCreateDescriptor(&amp;amp;plan, DFTI_SINGLE, DFTI_COMPLEX, 1, 320);&lt;/P&gt;&lt;P&gt;std::vector&amp;lt;MKL_LONG&amp;gt; input_strides(4);&lt;/P&gt;&lt;P&gt;input_strides[0] = 0; // MKL convention&lt;/P&gt;&lt;P&gt;input_strides[1] = 1;&lt;/P&gt;&lt;P&gt;input_strides[2] = 32;&lt;/P&gt;&lt;P&gt;input_strides[3] = 10240;&lt;/P&gt;&lt;P&gt;DftiSetValue(plan, DFTI_INPUT_STRIDES, input_strides.data());&lt;/P&gt;&lt;P&gt;DftiSetValue(plan, DFTI_NUMBER_OF_TRANSFORMS, 384);&lt;/P&gt;&lt;P&gt;DftiSetValue(plan, DFTI_INPUT_DISTANCE, 10240);&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;By setting DFTI_INPUT_DISTANCE to 10240, you're telling MKL that the maximum distance between the start of consecutive input data sets is 10240. This way, MKL can correctly handle the varying input distances for each batch of FFTs.&lt;/P&gt;&lt;P&gt;Note that you don't need to specify the strides or distances for the batched dimensions explicitly, as MKL will automatically compute them based on the DFTI_INPUT_DISTANCE and DFTI_NUMBER_OF_TRANSFORMS values.&lt;/P&gt;&lt;P&gt;Also, make sure to call DftiCommitDescriptor after setting all the required configuration parameters before computing the FFTs.&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 13 Aug 2024 03:55:35 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Batched-FFT-with-varying-input-distance/m-p/1622838#M36318</guid>
      <dc:creator>Mahan</dc:creator>
      <dc:date>2024-08-13T03:55:35Z</dc:date>
    </item>
    <item>
      <title>Re: Batched FFT with varying input distance</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Batched-FFT-with-varying-input-distance/m-p/1622881#M36320</link>
      <description>&lt;P&gt;Thanks for the attempt; I suppose I did say any help is appreciated, but it's clear your solution wasn't tested. Setting DFTI_INPUT_DISTANCE to 10240 assumes all transforms are equally spaced by that amount. My case involves varying distances.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You're suggesting that MKL automatically computes the strides and distances for batched dimensions, but if that's the case, how can MKL differentiate between a request for 384 transforms each spaced 10240 apart, and the scenario where input distances vary?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you had actually tried running this instead of just posting what seems like a response from ChatGPT (which, incidentally, is nearly identical to what you wrote), you would have realized it causes a segmentation fault.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Aug 2024 08:55:33 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Batched-FFT-with-varying-input-distance/m-p/1622881#M36320</guid>
      <dc:creator>henricryden</dc:creator>
      <dc:date>2024-08-13T08:55:33Z</dc:date>
    </item>
    <item>
      <title>Re:Batched FFT with varying input distance</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Batched-FFT-with-varying-input-distance/m-p/1623612#M36326</link>
      <description>&lt;P&gt;Hi Henric,&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Sorry for the late reply.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;I understand the complexity of the issue you mentioned. &lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;I am raising a feature request for this.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;If we want to perform batched 1D FFTs in the first or third direction, we can modify stride and distance to run just one batched FFT to get it done. The tricky problem is doing such FFTs in the second direction. &lt;/P&gt;&lt;P&gt;It would be either&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;SPAN style="font-size: inherit;"&gt;12 sub-batches, each with 32 FFTs of&amp;nbsp;distance 3840 and each 1D FFT with stride 12 &lt;/SPAN&gt;&lt;STRONG style="font-size: inherit;"&gt;or&lt;/STRONG&gt;&lt;SPAN style="font-size: inherit;"&gt; &lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="font-size: inherit;"&gt;32 sub-batches, each with 12 FFTs of distance 1 and each 1d FFT with stride 12&lt;/SPAN&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;Currently, oneMKL FFT doesn't have the feature to have one batched FFT in the second direction with variable/constant input distances.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 16 Aug 2024 04:50:17 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Batched-FFT-with-varying-input-distance/m-p/1623612#M36326</guid>
      <dc:creator>Mahan</dc:creator>
      <dc:date>2024-08-16T04:50:17Z</dc:date>
    </item>
    <item>
      <title>Re: Batched FFT with varying input distance</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Batched-FFT-with-varying-input-distance/m-p/1625381#M36339</link>
      <description>&lt;P&gt;Hi Henric,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The feature request has been communicated with the development team, and the feasibility of whether it's going to be implemented or not is under consideration. Once I have a clearer picture, I will let you know.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Aug 2024 09:47:16 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Batched-FFT-with-varying-input-distance/m-p/1625381#M36339</guid>
      <dc:creator>Mahan</dc:creator>
      <dc:date>2024-08-26T09:47:16Z</dc:date>
    </item>
    <item>
      <title>Re: Batched FFT with varying input distance</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Batched-FFT-with-varying-input-distance/m-p/1630212#M36414</link>
      <description>&lt;P&gt;Thank you for considering implementing this feature&lt;/P&gt;</description>
      <pubDate>Tue, 10 Sep 2024 20:11:17 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Batched-FFT-with-varying-input-distance/m-p/1630212#M36414</guid>
      <dc:creator>henricryden</dc:creator>
      <dc:date>2024-09-10T20:11:17Z</dc:date>
    </item>
    <item>
      <title>Re:Batched FFT with varying input distance</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Batched-FFT-with-varying-input-distance/m-p/1633527#M36475</link>
      <description>&lt;P&gt;Henric,&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;The feasibility of this feature is under consideration. As of now, there is now specific ETA on this.&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 26 Sep 2024 03:26:23 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Batched-FFT-with-varying-input-distance/m-p/1633527#M36475</guid>
      <dc:creator>Mahan</dc:creator>
      <dc:date>2024-09-26T03:26:23Z</dc:date>
    </item>
    <item>
      <title>Re:Batched FFT with varying input distance</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Batched-FFT-with-varying-input-distance/m-p/1633570#M36478</link>
      <description>&lt;P&gt;Henric,&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;The feasibility of this feature is under consideration. As of now, there is no specific ETA on this.&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 26 Sep 2024 09:19:01 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Batched-FFT-with-varying-input-distance/m-p/1633570#M36478</guid>
      <dc:creator>Mahan</dc:creator>
      <dc:date>2024-09-26T09:19:01Z</dc:date>
    </item>
  </channel>
</rss>

