<?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 How to call the DFT function in oneMKL in the sycl kernel? in Intel® oneAPI Math Kernel Library</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/How-to-call-the-DFT-function-in-oneMKL-in-the-sycl-kernel/m-p/1597701#M36124</link>
    <description>&lt;LI-CODE lang="markup"&gt;There are multiple errors reported:
SYCL kernel cannot call an undefined function without SYCL_EXTERNAL attribute 
SYCL kernel cannot call a variadic function Code &lt;/LI-CODE&gt;&lt;LI-CODE lang="cpp"&gt;#include &amp;lt;CL/sycl.hpp&amp;gt;
#include &amp;lt;mkl_dfti.h&amp;gt;
#include &amp;lt;iostream&amp;gt;
#include &amp;lt;complex&amp;gt;
#include &amp;lt;vector&amp;gt;

using namespace std;
using namespace sycl;

int main() {
    complex&amp;lt;double&amp;gt; input[48] = { 0.5, -0.991445, 0.258819, 0.793353, -0.866025, -0.130526, 0.965926, -0.608761, -0.5, 0.991445, -0.258819, -0.793353, 0.866025, 0.130526, -0.965926, 0.608761, 0.5, -0.991445, 0.258819, 0.793353, -0.866025, -0.130526, 0.965926, -0.608761, -0.5, 0.991445, -0.258819, -0.793353, 0.866025, 0.130526, -0.965926, 0.608761, 0.5, -0.991445, 0.258819, 0.793353, -0.866025, -0.130526, 0.965926, -0.608761, -0.5, 0.991445, -0.258819, -0.793353, 0.866025, 0.130526, -0.965926, 0.608761 };
    complex&amp;lt;double&amp;gt; output[48];  // Output for complex-to-complex DFT;

    // Create queue and device selector
    queue q(cpu_selector{});

    // Allocate memory for input and output on the device
    buffer&amp;lt;complex&amp;lt;double&amp;gt;, 1&amp;gt; input_buffer(input, range&amp;lt;1&amp;gt;(48));
    buffer&amp;lt;complex&amp;lt;double&amp;gt;, 1&amp;gt; output_buffer(output, range&amp;lt;1&amp;gt;(48));

    // Submit work to the queue for execution
    q.submit([&amp;amp;](handler&amp;amp; h) {
        // Get accessors to access data on the device
        auto input_accessor = input_buffer.get_access&amp;lt;access::mode::read&amp;gt;(h);
        auto output_accessor = output_buffer.get_access&amp;lt;access::mode::write&amp;gt;(h);

        // Execute DFT in kernel
        h.parallel_for(range&amp;lt;1&amp;gt;(1), [=](id&amp;lt;1&amp;gt; idx) {
            // Call MKL DFT setup and compute in kernel
            DFTI_DESCRIPTOR_HANDLE my_desc_handle = NULL; // Descriptor handle for complex-to-complex FFT;  
            MKL_LONG status; // Variable to store command execution status;
            status = DftiCreateDescriptor(&amp;amp;my_desc_handle, DFTI_DOUBLE, DFTI_COMPLEX, 1, 48); // Create a descriptor;  
            status = DftiSetValue(my_desc_handle, DFTI_PLACEMENT, DFTI_NOT_INPLACE); // Set non-inplace operation;
            status = DftiSetValue(my_desc_handle, DFTI_NUMBER_OF_TRANSFORMS, 1); // Set number of transforms to 1;
            status = DftiCommitDescriptor(my_desc_handle); // Commit descriptor to make configuration effective;
            status = DftiComputeForward(my_desc_handle, input_accessor.get_pointer(), output_accessor.get_pointer()); // Perform forward FFT;
            status = DftiFreeDescriptor(&amp;amp;my_desc_handle); // Free descriptor;
            });
        });

    // Wait for the queue to finish execution
    q.wait();

    // Output complex-to-complex FFT result
    cout &amp;lt;&amp;lt; "FFT result:" &amp;lt;&amp;lt; "\n";
    auto result = output_buffer.get_access&amp;lt;access::mode::read&amp;gt;();
    for (int i = 0; i &amp;lt; 48; i++) {
        cout &amp;lt;&amp;lt; result[i] &amp;lt;&amp;lt; "\n";
    }
    cout &amp;lt;&amp;lt; "\n";

    return 0;
}&lt;/LI-CODE&gt;</description>
    <pubDate>Wed, 15 May 2024 00:49:06 GMT</pubDate>
    <dc:creator>XinyeChu</dc:creator>
    <dc:date>2024-05-15T00:49:06Z</dc:date>
    <item>
      <title>How to call the DFT function in oneMKL in the sycl kernel?</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/How-to-call-the-DFT-function-in-oneMKL-in-the-sycl-kernel/m-p/1597701#M36124</link>
      <description>&lt;LI-CODE lang="markup"&gt;There are multiple errors reported:
SYCL kernel cannot call an undefined function without SYCL_EXTERNAL attribute 
SYCL kernel cannot call a variadic function Code &lt;/LI-CODE&gt;&lt;LI-CODE lang="cpp"&gt;#include &amp;lt;CL/sycl.hpp&amp;gt;
#include &amp;lt;mkl_dfti.h&amp;gt;
#include &amp;lt;iostream&amp;gt;
#include &amp;lt;complex&amp;gt;
#include &amp;lt;vector&amp;gt;

using namespace std;
using namespace sycl;

int main() {
    complex&amp;lt;double&amp;gt; input[48] = { 0.5, -0.991445, 0.258819, 0.793353, -0.866025, -0.130526, 0.965926, -0.608761, -0.5, 0.991445, -0.258819, -0.793353, 0.866025, 0.130526, -0.965926, 0.608761, 0.5, -0.991445, 0.258819, 0.793353, -0.866025, -0.130526, 0.965926, -0.608761, -0.5, 0.991445, -0.258819, -0.793353, 0.866025, 0.130526, -0.965926, 0.608761, 0.5, -0.991445, 0.258819, 0.793353, -0.866025, -0.130526, 0.965926, -0.608761, -0.5, 0.991445, -0.258819, -0.793353, 0.866025, 0.130526, -0.965926, 0.608761 };
    complex&amp;lt;double&amp;gt; output[48];  // Output for complex-to-complex DFT;

    // Create queue and device selector
    queue q(cpu_selector{});

    // Allocate memory for input and output on the device
    buffer&amp;lt;complex&amp;lt;double&amp;gt;, 1&amp;gt; input_buffer(input, range&amp;lt;1&amp;gt;(48));
    buffer&amp;lt;complex&amp;lt;double&amp;gt;, 1&amp;gt; output_buffer(output, range&amp;lt;1&amp;gt;(48));

    // Submit work to the queue for execution
    q.submit([&amp;amp;](handler&amp;amp; h) {
        // Get accessors to access data on the device
        auto input_accessor = input_buffer.get_access&amp;lt;access::mode::read&amp;gt;(h);
        auto output_accessor = output_buffer.get_access&amp;lt;access::mode::write&amp;gt;(h);

        // Execute DFT in kernel
        h.parallel_for(range&amp;lt;1&amp;gt;(1), [=](id&amp;lt;1&amp;gt; idx) {
            // Call MKL DFT setup and compute in kernel
            DFTI_DESCRIPTOR_HANDLE my_desc_handle = NULL; // Descriptor handle for complex-to-complex FFT;  
            MKL_LONG status; // Variable to store command execution status;
            status = DftiCreateDescriptor(&amp;amp;my_desc_handle, DFTI_DOUBLE, DFTI_COMPLEX, 1, 48); // Create a descriptor;  
            status = DftiSetValue(my_desc_handle, DFTI_PLACEMENT, DFTI_NOT_INPLACE); // Set non-inplace operation;
            status = DftiSetValue(my_desc_handle, DFTI_NUMBER_OF_TRANSFORMS, 1); // Set number of transforms to 1;
            status = DftiCommitDescriptor(my_desc_handle); // Commit descriptor to make configuration effective;
            status = DftiComputeForward(my_desc_handle, input_accessor.get_pointer(), output_accessor.get_pointer()); // Perform forward FFT;
            status = DftiFreeDescriptor(&amp;amp;my_desc_handle); // Free descriptor;
            });
        });

    // Wait for the queue to finish execution
    q.wait();

    // Output complex-to-complex FFT result
    cout &amp;lt;&amp;lt; "FFT result:" &amp;lt;&amp;lt; "\n";
    auto result = output_buffer.get_access&amp;lt;access::mode::read&amp;gt;();
    for (int i = 0; i &amp;lt; 48; i++) {
        cout &amp;lt;&amp;lt; result[i] &amp;lt;&amp;lt; "\n";
    }
    cout &amp;lt;&amp;lt; "\n";

    return 0;
}&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 15 May 2024 00:49:06 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/How-to-call-the-DFT-function-in-oneMKL-in-the-sycl-kernel/m-p/1597701#M36124</guid>
      <dc:creator>XinyeChu</dc:creator>
      <dc:date>2024-05-15T00:49:06Z</dc:date>
    </item>
    <item>
      <title>Re:How to call the DFT function in oneMKL in the sycl kernel?</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/How-to-call-the-DFT-function-in-oneMKL-in-the-sycl-kernel/m-p/1598192#M36129</link>
      <description>&lt;P&gt;Thanks for reaching out to us.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;We are producing the error from our side. Meanwhile, could you please provide us with the following details so that we could try to address the issue that you are getting?&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;The version of the DPC++ compiler being used and the OS environment details.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&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>Thu, 16 May 2024 08:43:08 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/How-to-call-the-DFT-function-in-oneMKL-in-the-sycl-kernel/m-p/1598192#M36129</guid>
      <dc:creator>SofeaAzrin_A_Intel</dc:creator>
      <dc:date>2024-05-16T08:43:08Z</dc:date>
    </item>
    <item>
      <title>Re: Re:How to call the DFT function in oneMKL in the sycl kernel?</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/How-to-call-the-DFT-function-in-oneMKL-in-the-sycl-kernel/m-p/1598567#M36133</link>
      <description>&lt;P class=""&gt;&lt;SPAN class=""&gt;My environment:&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;CPU: Intel(R) Core(TM) i7-1065G7 CPU&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;GPU: Intel(R) Iris(R) Plus Graphics&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;OS: Win11&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;IDE: VS2022&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;OneAPI BaseToolkit: 2024.0.1.45&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 17 May 2024 11:24:58 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/How-to-call-the-DFT-function-in-oneMKL-in-the-sycl-kernel/m-p/1598567#M36133</guid>
      <dc:creator>XinyeChu</dc:creator>
      <dc:date>2024-05-17T11:24:58Z</dc:date>
    </item>
    <item>
      <title>Re: Re:How to call the DFT function in oneMKL in the sycl kernel?</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/How-to-call-the-DFT-function-in-oneMKL-in-the-sycl-kernel/m-p/1598843#M36139</link>
      <description>&lt;P&gt;I can currently in the CPU(host) use oneMKL's DFT function to implement data calculations. But now I want to implement oneMKL's DFT operation in the device GPU. I tried many things but failed.So I came here hoping to get help, thank you!Btw,I use Intel oneAPI's DPC++ language.&lt;/P&gt;&lt;P&gt;My environment:&lt;/P&gt;&lt;P&gt;CPU: Intel(R) Core(TM) i7-1065G7 CPU;&lt;/P&gt;&lt;P&gt;GPU: Intel(R) Iris(R) Plus Graphics;&lt;/P&gt;&lt;P&gt;OS: Win11;&lt;/P&gt;&lt;P&gt;IDE: VS2022;&lt;/P&gt;&lt;P&gt;OneAPI BaseToolkit: 2024.0.1.45;&lt;/P&gt;&lt;P&gt;OneMath Kernel Library:2024.1.0.696;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;P&gt;I've tried encapsulating the DFT settings in a non-kernel function and then the device kernel calls that function. But it will report errors: 【SYCL kernel cannot call an undefined function without SYCL_EXTERNAL attribute】【 SYCL kernel cannot call a variadic function】&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;I checked the SYCL2020 standard: 【SYCL device code, as defined by this specification, does not support virtual function calls, function pointers in general, exceptions, runtime type information or the full set of C++ libraries that may depend on these features or on features of a particular host compiler. Nevertheless, these basic restrictions can be relieved by some specific Khronos or vendor extensions.】From the above, I can conclude that the DFT of Intel's oneMKL library should be callable in the kernel.（maybe？）&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;Expect to be able to call this DFT in the kernel (Intel GPU).&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;Below is the DFT implementing oneMKL in CPU：&lt;/P&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;#include &amp;lt;iostream&amp;gt;
#include &amp;lt;mkl_dfti.h&amp;gt;
#include &amp;lt;complex&amp;gt;
#include &amp;lt;vector&amp;gt;
using namespace std;

int main() {

    complex&amp;lt;double&amp;gt; input[48] = { 0.5,-0.991445,0.258819,0.793353,-0.866025,-0.130526,0.965926,-0.608761,-0.5,0.991445,-0.258819,-0.793353,0.8 66025,0.130526,-0.965926,0.608761, 0.5,-0.991445,0.258819,0.793353,-0.866025,-0.130526,0.965926,-0.608761,-0.5,0.991445,-0.258819,-0.793353,0.866025,0.13052 6,-0.965926,0.608761,0.5,-0.991445,0.258819,0.793353,- 0.866025,-0.130526,0.965926,-0.608761,-0.5,0.991445,-0.258819,-0.793353,0.866025,0.130526,-0.965926,0.608761 };
    complex&amp;lt;double&amp;gt; output[48]; // Output for complex-to-complex DFT;
    
    DFTI_DESCRIPTOR_HANDLE my_desc_handle = NULL; // Descriptor handle for complex to complex FFT;

    MKL_LONG status; // Variable to store command execution status;
    status = DftiCreateDescriptor(&amp;amp;my_desc_handle, DFTI_DOUBLE, DFTI_COMPLEX, 1, 48); // Create a descriptor;
    status = DftiSetValue(my_desc_handle, DFTI_PLACEMENT, DFTI_NOT_INPLACE); // Set non-in-place operations;
    status = DftiSetValue(my_desc_handle, DFTI_NUMBER_OF_TRANSFORMS, 1); //Set the number of transformations to 1;
    status = DftiCommitDescriptor(my_desc_handle); // Submit the descriptor to make its configuration effective;
    status = DftiComputeForward(my_desc_handle, input, output); // Execute forward FFT;
    status = DftiFreeDescriptor(&amp;amp;my_desc_handle); // Release descriptor;

    cout &amp;lt;&amp;lt; "FFT result:" &amp;lt;&amp;lt; endl; //Output the FFT result from complex number to complex number
    for (int i = 0; i &amp;lt; 48; i++) {
        cout &amp;lt;&amp;lt; output[i] &amp;lt;&amp;lt; "\n";
    }
    cout &amp;lt;&amp;lt; endl &amp;lt;&amp;lt; endl;

    return 0;
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 19 May 2024 16:52:04 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/How-to-call-the-DFT-function-in-oneMKL-in-the-sycl-kernel/m-p/1598843#M36139</guid>
      <dc:creator>XinyeChu</dc:creator>
      <dc:date>2024-05-19T16:52:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to call the DFT function in oneMKL in the sycl kernel?</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/How-to-call-the-DFT-function-in-oneMKL-in-the-sycl-kernel/m-p/1598846#M36140</link>
      <description>&lt;P&gt;&lt;STRONG&gt;Hope to get a reply as soon as possible, thank you！&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 19 May 2024 16:59:59 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/How-to-call-the-DFT-function-in-oneMKL-in-the-sycl-kernel/m-p/1598846#M36140</guid>
      <dc:creator>XinyeChu</dc:creator>
      <dc:date>2024-05-19T16:59:59Z</dc:date>
    </item>
    <item>
      <title>Re: Re:How to call the DFT function in oneMKL in the sycl kernel?</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/How-to-call-the-DFT-function-in-oneMKL-in-the-sycl-kernel/m-p/1598930#M36141</link>
      <description>Or is there any DFT code that can run on GPU? I want to run it</description>
      <pubDate>Mon, 20 May 2024 03:50:08 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/How-to-call-the-DFT-function-in-oneMKL-in-the-sycl-kernel/m-p/1598930#M36141</guid>
      <dc:creator>XinyeChu</dc:creator>
      <dc:date>2024-05-20T03:50:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to call the DFT function in oneMKL in the sycl kernel?</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/How-to-call-the-DFT-function-in-oneMKL-in-the-sycl-kernel/m-p/1599109#M36142</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.intel.com/t5/user/viewprofilepage/user-id/344243"&gt;@XinyeChu&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The &lt;FONT face="courier new,courier"&gt;DftiCreateDescriptor&lt;/FONT&gt; and other APIs you are using in your code are not SYCL APIs. They are C APIs that work only on CPUs. For using DFT on GPU devices, you need to use &lt;A href="https://www.intel.com/content/www/us/en/docs/onemkl/developer-reference-dpcpp/2024-1/descriptor-precision-domain.html" target="_self"&gt;oneMKL's SYCL/DPC++ APIs&lt;/A&gt;. There are examples of its usage distributed in the &lt;EM&gt;share/doc/mkl/examples/&amp;nbsp;&lt;/EM&gt;directory&amp;nbsp;contained in the oneMKL library that you have already downloaded. You would need to look at the &lt;EM&gt;sycl/dft/source/&lt;/EM&gt; directory under that for the DFT samples (possibly after extracting the "examples_sycl.zip"/"examples_sycl.tgz" archive files if they aren't already extracted out). One example is also available online&amp;nbsp;&lt;A href="https://www.intel.com/content/www/us/en/docs/onemkl/developer-reference-dpcpp/2024-1/configuring-and-computing-a-dft-in-dpc.html" target="_self"&gt;in the documentation&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope that helps.&lt;/P&gt;</description>
      <pubDate>Mon, 20 May 2024 16:41:23 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/How-to-call-the-DFT-function-in-oneMKL-in-the-sycl-kernel/m-p/1599109#M36142</guid>
      <dc:creator>Gajanan_Choudhary</dc:creator>
      <dc:date>2024-05-20T16:41:23Z</dc:date>
    </item>
  </channel>
</rss>

