<?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: Unable to declare vector inside SYCL_EXTERNAL function in Intel® oneAPI DPC++/C++ Compiler</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/Unable-to-declare-vector-inside-SYCL-EXTERNAL-function/m-p/1371690#M1994</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for posting in Intel Communities.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;From the above sample reproducer code, &lt;/SPAN&gt;please remove the vector declaration from "float Sample2::func2()" function, because the vector allocates memory dynamically which is not supported inside the kernel.&lt;/P&gt;
&lt;P&gt;For more information, please refer to this link:&lt;A href="https://link.springer.com/content/pdf/10.1007%2F978-1-4842-5574-2.pdf(pg" target="_blank" rel="noopener"&gt;https://link.springer.com/content/pdf/10.1007%2F978-1-4842-5574-2.pdf&amp;nbsp; &lt;/A&gt;DataParallel C++ book[page no:14]&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks &amp;amp; Regards,&lt;/P&gt;
&lt;P&gt;Hemanth.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 24 Mar 2022 12:08:38 GMT</pubDate>
    <dc:creator>HemanthCH_Intel</dc:creator>
    <dc:date>2022-03-24T12:08:38Z</dc:date>
    <item>
      <title>Unable to declare vector inside SYCL_EXTERNAL function</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/Unable-to-declare-vector-inside-SYCL-EXTERNAL-function/m-p/1371571#M1991</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I have a Main file containing Main.cpp&lt;BR /&gt;and Library.dll file containing the following&lt;BR /&gt;Sample1.h and Sample1.cpp&lt;BR /&gt;Sample2.h and Sample2.cpp&lt;BR /&gt;The Main.cpp invokes the Library.dll.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;Main.cpp&lt;/U&gt;&lt;/STRONG&gt;&lt;BR /&gt;#include &amp;lt;CL/sycl.hpp&amp;gt;&lt;BR /&gt;#include &amp;lt;vector&amp;gt;&lt;BR /&gt;#include &amp;lt;iostream&amp;gt;&lt;BR /&gt;#include &amp;lt;ext/intel/fpga_extensions.hpp&amp;gt;&lt;BR /&gt;#include&amp;lt;complex&amp;gt;&lt;BR /&gt;#include "../Library/Sample1.h"&lt;BR /&gt;#include "../Library/Sample2.h"&lt;BR /&gt;void test()&lt;BR /&gt;{&lt;BR /&gt;sycl::ext::intel::fpga_emulator_selector d_selector;&lt;BR /&gt;sycl::queue q(d_selector);&lt;BR /&gt;Sample1 obj1;&lt;BR /&gt;obj1.func1(q);&lt;BR /&gt;}&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;//************************************&lt;BR /&gt;// Demonstrate vector add both in sequential on CPU and in parallel on device.&lt;BR /&gt;//************************************&lt;BR /&gt;int main(int argc, char* argv[]) {&lt;BR /&gt;test();&lt;BR /&gt;return 0;&lt;BR /&gt;}&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;Sample1.h&lt;/U&gt;&lt;/STRONG&gt; &lt;BR /&gt;#pragma once&lt;BR /&gt;#include &amp;lt;CL/sycl.hpp&amp;gt;&lt;BR /&gt;#include &amp;lt;vector&amp;gt;&lt;BR /&gt;#include &amp;lt;iostream&amp;gt;&lt;BR /&gt;#include&amp;lt;complex&amp;gt;&lt;BR /&gt;#include &amp;lt;ext/intel/fpga_extensions.hpp&amp;gt;&lt;/P&gt;
&lt;P&gt;class _declspec(dllexport)Sample1&lt;BR /&gt;{&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;public:&lt;BR /&gt;Sample1();&lt;BR /&gt;~Sample1();&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;void func1(sycl::queue&amp;amp; q);&lt;/P&gt;
&lt;P&gt;};&lt;/P&gt;
&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;Sample1.cpp&lt;/STRONG&gt;&lt;/U&gt;&lt;BR /&gt;#include "Sample1.h"&lt;BR /&gt;#include "Sample2.h"&lt;/P&gt;
&lt;P&gt;Sample1::Sample1()&lt;BR /&gt;{&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;Sample1::~Sample1()&lt;BR /&gt;{&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;void Sample1::func1(sycl::queue&amp;amp; q)&lt;BR /&gt;{&lt;/P&gt;
&lt;P&gt;try&lt;BR /&gt;{&lt;/P&gt;
&lt;P&gt;q.submit([&amp;amp;](sycl::handler&amp;amp; h)&lt;BR /&gt;{&lt;BR /&gt;&lt;BR /&gt;h.parallel_for(sycl::range{ 4, 2 }, [=](sycl::id&amp;lt;2&amp;gt; idx) {&lt;BR /&gt;Sample2 obj;&lt;BR /&gt;obj.func2();&lt;BR /&gt;});&lt;BR /&gt;});&lt;/P&gt;
&lt;P&gt;q.wait_and_throw();&lt;BR /&gt;}&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;catch (sycl::exception const&amp;amp; e)&lt;BR /&gt;{&lt;BR /&gt;std::cout &amp;lt;&amp;lt; "Caught a SYCL host exception:\n" &amp;lt;&amp;lt; e.what() &amp;lt;&amp;lt; "\n";&lt;BR /&gt;}&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;}&lt;/P&gt;
&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;Sample2.h&lt;/STRONG&gt;&lt;/U&gt;&lt;BR /&gt;#pragma once&lt;BR /&gt;#include &amp;lt;CL/sycl.hpp&amp;gt;&lt;BR /&gt;#include &amp;lt;vector&amp;gt;&lt;BR /&gt;#include &amp;lt;iostream&amp;gt;&lt;BR /&gt;#include &amp;lt;ext/intel/fpga_extensions.hpp&amp;gt;&lt;BR /&gt;#include&amp;lt;complex&amp;gt;&lt;BR /&gt;class _declspec(dllexport)Sample2&lt;BR /&gt;{&lt;BR /&gt;public:&lt;BR /&gt;&lt;BR /&gt;SYCL_EXTERNAL Sample2();&lt;BR /&gt;SYCL_EXTERNAL ~Sample2();&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;SYCL_EXTERNAL float func2();&lt;/P&gt;
&lt;P&gt;};&lt;/P&gt;
&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;Sample2.cpp&lt;/STRONG&gt;&lt;/U&gt;&lt;BR /&gt;#include "Sample2.h"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sample2::Sample2()&lt;BR /&gt;{&lt;BR /&gt;&lt;BR /&gt;}&lt;/P&gt;
&lt;P&gt;Sample2::~Sample2()&lt;BR /&gt;{&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;float Sample2::func2()&lt;BR /&gt;{&lt;BR /&gt;std::vector&amp;lt;std::complex&amp;lt;float&amp;gt;&amp;gt;S(3);&lt;BR /&gt;return 0.1f;&lt;BR /&gt;}&lt;/P&gt;
&lt;P&gt;I have declared the complex float vector S. When I build this program, it throws an erro showing: SYCL kernel cannot call an undefined function without SYCL_EXTERNAL attribute &lt;BR /&gt;I would appreciate your help on this problem.&lt;BR /&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Thu, 24 Mar 2022 04:22:05 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/Unable-to-declare-vector-inside-SYCL-EXTERNAL-function/m-p/1371571#M1991</guid>
      <dc:creator>student4</dc:creator>
      <dc:date>2022-03-24T04:22:05Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to declare vector inside SYCL_EXTERNAL function</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/Unable-to-declare-vector-inside-SYCL-EXTERNAL-function/m-p/1371690#M1994</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for posting in Intel Communities.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;From the above sample reproducer code, &lt;/SPAN&gt;please remove the vector declaration from "float Sample2::func2()" function, because the vector allocates memory dynamically which is not supported inside the kernel.&lt;/P&gt;
&lt;P&gt;For more information, please refer to this link:&lt;A href="https://link.springer.com/content/pdf/10.1007%2F978-1-4842-5574-2.pdf(pg" target="_blank" rel="noopener"&gt;https://link.springer.com/content/pdf/10.1007%2F978-1-4842-5574-2.pdf&amp;nbsp; &lt;/A&gt;DataParallel C++ book[page no:14]&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks &amp;amp; Regards,&lt;/P&gt;
&lt;P&gt;Hemanth.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Mar 2022 12:08:38 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/Unable-to-declare-vector-inside-SYCL-EXTERNAL-function/m-p/1371690#M1994</guid>
      <dc:creator>HemanthCH_Intel</dc:creator>
      <dc:date>2022-03-24T12:08:38Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to declare vector inside SYCL_EXTERNAL function</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/Unable-to-declare-vector-inside-SYCL-EXTERNAL-function/m-p/1371899#M1996</link>
      <description>&lt;P&gt;Thanks for the clarification.&lt;/P&gt;</description>
      <pubDate>Fri, 25 Mar 2022 02:01:54 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/Unable-to-declare-vector-inside-SYCL-EXTERNAL-function/m-p/1371899#M1996</guid>
      <dc:creator>student4</dc:creator>
      <dc:date>2022-03-25T02:01:54Z</dc:date>
    </item>
    <item>
      <title>Re:Unable to declare vector inside SYCL_EXTERNAL function</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/Unable-to-declare-vector-inside-SYCL-EXTERNAL-function/m-p/1371936#M1997</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Thanks for accepting our solution. If you need any additional information, please post a new question as this thread will no longer be monitored by Intel.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; Regards,&lt;/P&gt;&lt;P&gt;Hemanth.&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 25 Mar 2022 04:38:21 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/Unable-to-declare-vector-inside-SYCL-EXTERNAL-function/m-p/1371936#M1997</guid>
      <dc:creator>HemanthCH_Intel</dc:creator>
      <dc:date>2022-03-25T04:38:21Z</dc:date>
    </item>
  </channel>
</rss>

