<?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:sycl::stream causing segfault? in Intel® oneAPI DPC++/C++ Compiler</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/sycl-stream-causing-segfault/m-p/1191313#M560</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;As we discussed in your previous thread (&lt;A href="https://community.intel.com/t5/Intel-oneAPI-Data-Parallel-C/std-ostream-lt-lt-vec-lt-T-length-gt-not-supoorted-in-OneAPI/m-p/1190955#M557" target="_blank"&gt;https://community.intel.com/t5/Intel-oneAPI-Data-Parallel-C/std-ostream-lt-lt-vec-lt-T-length-gt-not-supoorted-in-OneAPI/m-p/1190955#M557&lt;/A&gt;).&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;The stream class is designed to use &lt;B&gt;only within kernels&lt;/B&gt; in order to stream from the kernel back to the host CPU for printing via stdout.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;The stream instance is constructed in host within the command group scope and takes maximum buffer size, maximum stream size, and command group handler instance as parameters.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;B&gt;cl::sycl::stream sout(&amp;lt;max_buffer_size&amp;gt;, &amp;lt;max_stream_size&amp;gt;, &amp;lt;cgh&amp;gt;);&amp;nbsp;&lt;/B&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;B&gt;maximum buffer size &lt;/B&gt;= the overall character stream that can be output in characters (a character is of size sizeof(char) bytes) during kernel invocation (the aggregate of outputs from all work items).&lt;/P&gt;&lt;P&gt;&lt;B&gt;maximum stream size&amp;nbsp;&lt;/B&gt;= this specifies the maximum size of the character stream (number of characters) that can be output within a work item before a flush must be performed (maximum number of characters that can be used in a single statement on the stream).&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;When strings are stream to the object within a kernel, the contents are stored on an internal cl_mem object until the kernel finishes execution. The output is then output to stdout when the stream object is destroyed by the runtime.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;In the sample code provided by you, as sout&amp;lt;&amp;lt; () is getting invoked &lt;B&gt;outside the kernel&lt;/B&gt; (parallel_for), it is causing the &lt;B&gt;&lt;I&gt;segmentation fault&lt;/I&gt;&lt;/B&gt; error. Whereas for the sout&amp;lt;&amp;lt;() which was invoked &lt;B&gt;inside the kernel&lt;/B&gt; you don't see any issues.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Please let us know if the above information helped you. &lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Goutham&lt;/P&gt;&lt;BR /&gt;</description>
    <pubDate>Fri, 10 Jul 2020 10:35:31 GMT</pubDate>
    <dc:creator>GouthamK_Intel</dc:creator>
    <dc:date>2020-07-10T10:35:31Z</dc:date>
    <item>
      <title>sycl::stream causing segfault?</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/sycl-stream-causing-segfault/m-p/1191141#M558</link>
      <description>&lt;P&gt;Given the following (example) source...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="cpp"&gt;#include &amp;lt;CL/sycl.hpp&amp;gt;
namespace sycl = cl::sycl;
const int Nproc = 6;
int
main(int argc, char *argv[])
{
    sycl::device dev = sycl::cpu_selector().select_device();
    sycl::queue q(dev);
    q.submit([&amp;amp;](sycl::handler&amp;amp; cgh) {
      sycl::stream sout {1024, 1024, cgh};
      sout &amp;lt;&amp;lt; "Kernel" &amp;lt;&amp;lt; sycl::endl;
      cgh.parallel_for&amp;lt;class kernelCPU&amp;gt;(
          sycl::range&amp;lt;1&amp;gt; {Nproc},
          [=] (sycl::item&amp;lt;1&amp;gt; item) {
              int idx = item.get_linear_id();
              sout &amp;lt;&amp;lt; idx &amp;lt;&amp;lt; sycl::endl;
              }
          );
      }
      );
}
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;... built/run as follows...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="none"&gt;user@t570:~/OneAPI/SYCL$ dpcpp --version
Intel(R) oneAPI DPC++ Compiler 2021.1-beta07 (2020.5.0.0604)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /local/opt/inteloneapi/compiler/latest/linux/bin
user@t570:~/OneAPI/SYCL$ make bug4
dpcpp -O3 -g -mavx2 -o bug4 bug4.cpp -lOpenCL -lsycl
user@t570:~/OneAPI/SYCL$ ./bug4
PLEASE submit a bug report to https://software.intel.com/en-us/support/priority-support and include the crash backtrace.
Segmentation fault (core dumped)
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The offending line is the "sout &amp;lt;&amp;lt; "Kernel" &amp;lt;&amp;lt; sycl::endl;".&amp;nbsp; Comment that out and the fault disappears.&lt;/P&gt;
&lt;P&gt;I'm not sure if this is a dpc++ bug, or a "me" bug, but it said to report it so...&amp;nbsp; (fyi I don't have priority support so I'm doing it here).&lt;/P&gt;</description>
      <pubDate>Thu, 09 Jul 2020 23:56:10 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/sycl-stream-causing-segfault/m-p/1191141#M558</guid>
      <dc:creator>CFR</dc:creator>
      <dc:date>2020-07-09T23:56:10Z</dc:date>
    </item>
    <item>
      <title>Re:sycl::stream causing segfault?</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/sycl-stream-causing-segfault/m-p/1191313#M560</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;As we discussed in your previous thread (&lt;A href="https://community.intel.com/t5/Intel-oneAPI-Data-Parallel-C/std-ostream-lt-lt-vec-lt-T-length-gt-not-supoorted-in-OneAPI/m-p/1190955#M557" target="_blank"&gt;https://community.intel.com/t5/Intel-oneAPI-Data-Parallel-C/std-ostream-lt-lt-vec-lt-T-length-gt-not-supoorted-in-OneAPI/m-p/1190955#M557&lt;/A&gt;).&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;The stream class is designed to use &lt;B&gt;only within kernels&lt;/B&gt; in order to stream from the kernel back to the host CPU for printing via stdout.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;The stream instance is constructed in host within the command group scope and takes maximum buffer size, maximum stream size, and command group handler instance as parameters.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;B&gt;cl::sycl::stream sout(&amp;lt;max_buffer_size&amp;gt;, &amp;lt;max_stream_size&amp;gt;, &amp;lt;cgh&amp;gt;);&amp;nbsp;&lt;/B&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;B&gt;maximum buffer size &lt;/B&gt;= the overall character stream that can be output in characters (a character is of size sizeof(char) bytes) during kernel invocation (the aggregate of outputs from all work items).&lt;/P&gt;&lt;P&gt;&lt;B&gt;maximum stream size&amp;nbsp;&lt;/B&gt;= this specifies the maximum size of the character stream (number of characters) that can be output within a work item before a flush must be performed (maximum number of characters that can be used in a single statement on the stream).&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;When strings are stream to the object within a kernel, the contents are stored on an internal cl_mem object until the kernel finishes execution. The output is then output to stdout when the stream object is destroyed by the runtime.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;In the sample code provided by you, as sout&amp;lt;&amp;lt; () is getting invoked &lt;B&gt;outside the kernel&lt;/B&gt; (parallel_for), it is causing the &lt;B&gt;&lt;I&gt;segmentation fault&lt;/I&gt;&lt;/B&gt; error. Whereas for the sout&amp;lt;&amp;lt;() which was invoked &lt;B&gt;inside the kernel&lt;/B&gt; you don't see any issues.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Please let us know if the above information helped you. &lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Goutham&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 10 Jul 2020 10:35:31 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/sycl-stream-causing-segfault/m-p/1191313#M560</guid>
      <dc:creator>GouthamK_Intel</dc:creator>
      <dc:date>2020-07-10T10:35:31Z</dc:date>
    </item>
    <item>
      <title>Re:sycl::stream causing segfault?</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/sycl-stream-causing-segfault/m-p/1192558#M571</link>
      <description>&lt;P&gt;Hi, &lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Could you please confirm if your issue is resolved?&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Goutham&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 15 Jul 2020 12:30:15 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/sycl-stream-causing-segfault/m-p/1192558#M571</guid>
      <dc:creator>GouthamK_Intel</dc:creator>
      <dc:date>2020-07-15T12:30:15Z</dc:date>
    </item>
    <item>
      <title>Re: Re:sycl::stream causing segfault?</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/sycl-stream-causing-segfault/m-p/1193382#M582</link>
      <description>&lt;P&gt;I understand my error.&amp;nbsp; Thanks.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jul 2020 23:49:08 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/sycl-stream-causing-segfault/m-p/1193382#M582</guid>
      <dc:creator>CFR</dc:creator>
      <dc:date>2020-07-17T23:49:08Z</dc:date>
    </item>
    <item>
      <title>Re:sycl::stream causing segfault?</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/sycl-stream-causing-segfault/m-p/1193533#M583</link>
      <description>&lt;P&gt;Hi, &lt;/P&gt;&lt;P&gt;Thanks for the confirmation.!&lt;/P&gt;&lt;P&gt;This issue has been resolved and we will no longer respond to this thread.&amp;nbsp;If you require additional assistance from Intel, please start a new thread.&amp;nbsp;Any further interaction in this thread will be considered community only.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Have a Good day.!&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;Goutham&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 20 Jul 2020 06:18:35 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/sycl-stream-causing-segfault/m-p/1193533#M583</guid>
      <dc:creator>GouthamK_Intel</dc:creator>
      <dc:date>2020-07-20T06:18:35Z</dc:date>
    </item>
  </channel>
</rss>

