<?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: DPC++ ERROR in Intel® oneAPI DPC++/C++ Compiler</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/DPC-ERROR/m-p/1593096#M3685</link>
    <description>&lt;P&gt;Can you please send your reproducer as an attachment? The code provided seems to have some problem and cannot be compiled.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 27 Apr 2024 07:10:14 GMT</pubDate>
    <dc:creator>Alex_Y_Intel</dc:creator>
    <dc:date>2024-04-27T07:10:14Z</dc:date>
    <item>
      <title>DPC++ ERROR</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/DPC-ERROR/m-p/1591944#M3669</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="andrew11111_0-1713893962729.png" style="width: 400px;"&gt;&lt;img src="https://community.intel.com/t5/image/serverpage/image-id/54074iC36099E353FC7165/image-size/medium/is-moderation-mode/true?v=v2&amp;amp;px=400&amp;amp;whitelist-exif-data=Orientation%2CResolution%2COriginalDefaultFinalSize%2CCopyright" role="button" title="andrew11111_0-1713893962729.png" alt="andrew11111_0-1713893962729.png" /&gt;&lt;/span&gt;Exception thrown at 0x00007FF94628AC4D (igc64.dll) in dpc please work!.exe: 0xC0000005: Access violation reading location 0x0000000000000008.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;press 2 select gp&lt;/P&gt;&lt;P&gt;When i try use my intel gpu i get this error i cannot fix it!&lt;/P&gt;&lt;P&gt;using laptop&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="andrew11111_1-1713894186676.png" style="width: 400px;"&gt;&lt;img src="https://community.intel.com/t5/image/serverpage/image-id/54075i9B5F3EECA9A1FF6A/image-size/medium/is-moderation-mode/true?v=v2&amp;amp;px=400&amp;amp;whitelist-exif-data=Orientation%2CResolution%2COriginalDefaultFinalSize%2CCopyright" role="button" title="andrew11111_1-1713894186676.png" alt="andrew11111_1-1713894186676.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;trying to use GPU 0&lt;/P&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;&amp;nbsp;&lt;/P&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;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;lt;-------CODE--------&amp;gt;&lt;/P&gt;&lt;P&gt;#include &amp;lt;CL/sycl.hpp&amp;gt;&lt;BR /&gt;#include &amp;lt;iostream&amp;gt;&lt;BR /&gt;#include &amp;lt;fstream&amp;gt;&lt;BR /&gt;#include &amp;lt;cmath&amp;gt;&lt;BR /&gt;#include &amp;lt;chrono&amp;gt;&lt;BR /&gt;using namespace sycl;&lt;BR /&gt;using std::chrono::duration_cast;&lt;BR /&gt;using std::chrono::milliseconds;&lt;BR /&gt;using std::cout;&lt;BR /&gt;using std::endl;&lt;BR /&gt;using std::ofstream;&lt;BR /&gt;typedef std::chrono::steady_clock the_clock;&lt;BR /&gt;const int WIDTH = 1920;&lt;BR /&gt;const int HEIGHT = 1080;&lt;BR /&gt;const int MAX_ITERATIONS = 500;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;uint32_t img[HEIGHT][WIDTH];&lt;BR /&gt;void write_tga(const char* filename)&lt;BR /&gt;{&lt;/P&gt;&lt;P&gt;ofstream outfile(filename, ofstream::binary);&lt;/P&gt;&lt;P&gt;uint8_t header[18] = {&lt;BR /&gt;0, // no img ID&lt;BR /&gt;0, // no colour map&lt;BR /&gt;2, // uncompressed 24-bit img&lt;BR /&gt;0, 0, 0, 0, 0, // empty colour map specification&lt;BR /&gt;0, 0, // X origin&lt;BR /&gt;0, 0, // Y origin&lt;BR /&gt;WIDTH &amp;amp; 0xFF, (WIDTH &amp;gt;&amp;gt; &lt;LI-EMOJI id="lia_smiling-face-with-sunglasses" title=":smiling_face_with_sunglasses:"&gt;&lt;/LI-EMOJI&gt; &amp;amp; 0xFF, // width&lt;BR /&gt;HEIGHT &amp;amp; 0xFF, (HEIGHT &amp;gt;&amp;gt; &lt;LI-EMOJI id="lia_smiling-face-with-sunglasses" title=":smiling_face_with_sunglasses:"&gt;&lt;/LI-EMOJI&gt; &amp;amp; 0xFF, // height&lt;BR /&gt;24, // bits per pixel&lt;BR /&gt;0, // img descriptor&lt;BR /&gt;};&lt;BR /&gt;outfile.write((const char*)header, 18);&lt;/P&gt;&lt;P&gt;for (int y = 0; y &amp;lt; HEIGHT; ++y)&lt;BR /&gt;{&lt;BR /&gt;for (int x = 0; x &amp;lt; WIDTH; ++x)&lt;BR /&gt;{&lt;BR /&gt;uint8_t pixel[3] = {&lt;BR /&gt;img[y][x] &amp;amp; 0xFF, // blue channel&lt;BR /&gt;(img[y][x] &amp;gt;&amp;gt; &lt;LI-EMOJI id="lia_smiling-face-with-sunglasses" title=":smiling_face_with_sunglasses:"&gt;&lt;/LI-EMOJI&gt; &amp;amp; 0xFF, // green channel&lt;BR /&gt;(img[y][x] &amp;gt;&amp;gt; 16) &amp;amp; 0xFF, // red channel&lt;BR /&gt;};&lt;BR /&gt;outfile.write((const char*)pixel, 3);&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;outfile.close();&lt;BR /&gt;if (!outfile)&lt;BR /&gt;{&lt;BR /&gt;// An error has occurred at some point since we opened the file.&lt;BR /&gt;std::cout &amp;lt;&amp;lt; "Error writing to " &amp;lt;&amp;lt; filename &amp;lt;&amp;lt; std::endl;&lt;BR /&gt;exit(1);&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;void write_tgaK9(const char* filename, uint32_t* img)&lt;BR /&gt;{&lt;BR /&gt;std::ofstream file(filename, std::ios::binary);&lt;/P&gt;&lt;P&gt;// TGA header&lt;BR /&gt;uint8_t header[18] = { 0 };&lt;BR /&gt;header[2] = 2; // truecolor&lt;BR /&gt;header[12] = WIDTH &amp;amp; 0xFF;&lt;BR /&gt;header[13] = WIDTH &amp;gt;&amp;gt; 8;&lt;BR /&gt;header[14] = HEIGHT &amp;amp; 0xFF;&lt;BR /&gt;header[15] = HEIGHT &amp;gt;&amp;gt; 8;&lt;BR /&gt;header[16] = 24; // bits per pixel&lt;/P&gt;&lt;P&gt;file.write(reinterpret_cast&amp;lt;char*&amp;gt;(header), sizeof(header));&lt;/P&gt;&lt;P&gt;// Pixel data&lt;BR /&gt;for (int y = 0; y &amp;lt; HEIGHT; ++y)&lt;BR /&gt;{&lt;BR /&gt;for (int x = 0; x &amp;lt; WIDTH; ++x)&lt;BR /&gt;{&lt;BR /&gt;uint32_t pixel = img[y * WIDTH + x];&lt;BR /&gt;uint8_t b = pixel &amp;amp; 0xFF;&lt;BR /&gt;uint8_t g = (pixel &amp;gt;&amp;gt; &lt;LI-EMOJI id="lia_smiling-face-with-sunglasses" title=":smiling_face_with_sunglasses:"&gt;&lt;/LI-EMOJI&gt; &amp;amp; 0xFF;&lt;BR /&gt;uint8_t r = (pixel &amp;gt;&amp;gt; 16) &amp;amp; 0xFF;&lt;BR /&gt;file.put(b);&lt;BR /&gt;file.put(g);&lt;BR /&gt;file.put(r);&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;file.close();&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;struct ComplexF {&lt;BR /&gt;float x;&lt;BR /&gt;float y;&lt;BR /&gt;};&lt;BR /&gt;ComplexF c_add(ComplexF c1, ComplexF c2)&lt;BR /&gt;{&lt;BR /&gt;ComplexF tmp;&lt;BR /&gt;float a = c1.x;&lt;BR /&gt;float b = c1.y;&lt;BR /&gt;float c = c2.x;&lt;BR /&gt;float d = c2.y;&lt;BR /&gt;tmp.x = a + c;&lt;BR /&gt;tmp.y = b + d;&lt;BR /&gt;return tmp;&lt;BR /&gt;} // c_add&lt;BR /&gt;float c_abs(ComplexF c)&lt;BR /&gt;{&lt;BR /&gt;return sycl::sqrt(c.x * c.x + c.y * c.y);&lt;BR /&gt;} // c_abs&lt;BR /&gt;ComplexF c_mul(ComplexF c1, ComplexF c2)&lt;BR /&gt;{&lt;BR /&gt;ComplexF tmp;&lt;BR /&gt;float a = c1.x;&lt;BR /&gt;float b = c1.y;&lt;BR /&gt;float c = c2.x;&lt;BR /&gt;float d = c2.y;&lt;BR /&gt;tmp.x = a * c - b * d;&lt;BR /&gt;tmp.y = b * c + a * d;&lt;BR /&gt;return tmp;&lt;BR /&gt;} // c_mul&lt;BR /&gt;void selectDevice(queue&amp;amp; Q)&lt;BR /&gt;{&lt;BR /&gt;int whatToUse{};&lt;BR /&gt;std::cout &amp;lt;&amp;lt; "Enter 1 for CPU, 2 for GPU: ";&lt;BR /&gt;std::cin &amp;gt;&amp;gt; whatToUse;&lt;/P&gt;&lt;P&gt;if (whatToUse == 1)&lt;BR /&gt;{&lt;BR /&gt;std::cout &amp;lt;&amp;lt; "You have selected CPU\n";&lt;BR /&gt;Q = queue(cpu_selector{});&lt;BR /&gt;}&lt;BR /&gt;else if (whatToUse == 2)&lt;BR /&gt;{&lt;BR /&gt;std::cout &amp;lt;&amp;lt; "You have selected GPU\n";&lt;BR /&gt;Q = queue(gpu_selector{});&lt;BR /&gt;}&lt;BR /&gt;else&lt;BR /&gt;{&lt;BR /&gt;std::cout &amp;lt;&amp;lt; "Invalid selection. Exiting...\n";&lt;BR /&gt;std::cout &amp;lt;&amp;lt; "Defaulting to CPU\n";&lt;BR /&gt;Q = queue(cpu_selector{});&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;system("cls");&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;void generateJuliaSet(queue&amp;amp; Q, buffer&amp;lt;uint32_t, 2&amp;gt;&amp;amp; img_buf)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;Q.submit([&amp;amp;](handler&amp;amp; h) {&lt;BR /&gt;auto img_acc = img_buf.get_access&amp;lt;access::mode::write&amp;gt;(h);&lt;BR /&gt;h.parallel_for(range&amp;lt;2&amp;gt;(HEIGHT, WIDTH), [=](id&amp;lt;2&amp;gt; idx) {&lt;BR /&gt;auto y = idx[0]; // Row&lt;BR /&gt;auto x = idx[1]; // Column&lt;BR /&gt;float left = -2.0, right = 2.0, top = 2.0, bottom = -2.0;&lt;BR /&gt;ComplexF z = { left + (right - left) * x / WIDTH, top + (bottom - top) * y / HEIGHT };&lt;BR /&gt;ComplexF c = { 0.285f, 0.01f }; // You can change these values for different Julia sets&lt;BR /&gt;int iterations = 0;&lt;BR /&gt;while (c_abs(z) &amp;lt; 2.0f &amp;amp;&amp;amp; iterations &amp;lt; MAX_ITERATIONS) {&lt;BR /&gt;z = c_add(c_mul(z, z), c);&lt;BR /&gt;iterations++;&lt;BR /&gt;}&lt;BR /&gt;if (iterations == MAX_ITERATIONS)&lt;BR /&gt;{&lt;BR /&gt;// z didn't escape from the circle.&lt;BR /&gt;// This point is in the Julia set.&lt;BR /&gt;img_acc[{y, x}] = 0x000000; // black&lt;BR /&gt;}&lt;BR /&gt;else&lt;BR /&gt;{&lt;BR /&gt;uint8_t red = static_cast&amp;lt;uint8_t&amp;gt;(128.0f + cos(iterations * 0.15f) * 128.0f);&lt;BR /&gt;uint8_t green = static_cast&amp;lt;uint8_t&amp;gt;(128.0f + cos(iterations * 0.16f) * 128.0f);&lt;BR /&gt;uint8_t blue = static_cast&amp;lt;uint8_t&amp;gt;(128.0f + sin(iterations * 0.17f) * 128.0f);&lt;BR /&gt;img_acc[{y, x}] = (red &amp;lt;&amp;lt; 16) | (green &amp;lt;&amp;lt; &lt;LI-EMOJI id="lia_smiling-face-with-sunglasses" title=":smiling_face_with_sunglasses:"&gt;&lt;/LI-EMOJI&gt; | blue;&lt;BR /&gt;}&lt;BR /&gt;});&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;Q.wait();&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;//Declare the host accessor host_acc to read from the buffer img_buf&lt;BR /&gt;auto host_acc = img_buf.get_access&amp;lt;access::mode::read&amp;gt;();&lt;/P&gt;&lt;P&gt;for (int y = 0; y &amp;lt; HEIGHT; ++y)&lt;BR /&gt;{&lt;BR /&gt;for (int x = 0; x &amp;lt; WIDTH; ++x) {&lt;BR /&gt;img[y][x] = host_acc[y][x];&lt;BR /&gt;if ((y &amp;lt; 5) &amp;amp;&amp;amp; (x &amp;lt; 5)) {&lt;BR /&gt;std::cout &amp;lt;&amp;lt; host_acc[y][x] &amp;lt;&amp;lt; ", ";&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;if (y &amp;lt; 5) {&lt;BR /&gt;std::cout &amp;lt;&amp;lt; "\n";&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;write_tga("Julia.tga");&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;// implement a function to generate a Julia set using nd-range&lt;/P&gt;&lt;P&gt;void generateJuliaSetNDRange(queue&amp;amp; Q, buffer&amp;lt;uint32_t, 2&amp;gt;&amp;amp; img_buf)&lt;BR /&gt;{&lt;BR /&gt;Q.submit([&amp;amp;](handler&amp;amp; h) {&lt;BR /&gt;auto img_acc = img_buf.get_access&amp;lt;access::mode::write&amp;gt;(h);&lt;BR /&gt;h.parallel_for(nd_range&amp;lt;2&amp;gt;(range&amp;lt;2&amp;gt;(HEIGHT, WIDTH), range&amp;lt;2&amp;gt;(1, 1)), [=](nd_item&amp;lt;2&amp;gt; idx) {&lt;BR /&gt;auto y = idx.get_global_id(0); // Row&lt;BR /&gt;auto x = idx.get_global_id(1); // Column&lt;BR /&gt;float left = -2.0, right = 2.0, top = 2.0, bottom = -2.0;&lt;BR /&gt;ComplexF z = { left + (right - left) * x / WIDTH, top + (bottom - top) * y / HEIGHT };&lt;BR /&gt;ComplexF c = { 0.285f, 0.01f }; // You can change these values for different Julia sets&lt;BR /&gt;int iterations = 0;&lt;BR /&gt;while (c_abs(z) &amp;lt; 2.0f &amp;amp;&amp;amp; iterations &amp;lt; MAX_ITERATIONS) {&lt;BR /&gt;z = c_add(c_mul(z, z), c);&lt;BR /&gt;iterations++;&lt;BR /&gt;}&lt;BR /&gt;if (iterations == MAX_ITERATIONS)&lt;BR /&gt;{&lt;BR /&gt;// z didn't escape from the circle.&lt;BR /&gt;// This point is in the Julia set.&lt;BR /&gt;img_acc[{y, x}] = 0x000000; // black&lt;BR /&gt;}&lt;BR /&gt;else&lt;BR /&gt;{&lt;BR /&gt;uint8_t red = static_cast&amp;lt;uint8_t&amp;gt;(128.0f + cos(iterations * 0.15f) * 128.0f);&lt;BR /&gt;uint8_t green = static_cast&amp;lt;uint8_t&amp;gt;(128.0f + cos(iterations * 0.16f) * 128.0f);&lt;BR /&gt;uint8_t blue = static_cast&amp;lt;uint8_t&amp;gt;(128.0f + sin(iterations * 0.17f) * 128.0f);&lt;BR /&gt;img_acc[{y, x}] = (red &amp;lt;&amp;lt; 16) | (green &amp;lt;&amp;lt; &lt;LI-EMOJI id="lia_smiling-face-with-sunglasses" title=":smiling_face_with_sunglasses:"&gt;&lt;/LI-EMOJI&gt; | blue;&lt;BR /&gt;}&lt;BR /&gt;});&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;Q.wait();&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;//Declare the host accessor host_acc to read from the buffer img_buf&lt;BR /&gt;auto host_acc = img_buf.get_access&amp;lt;access::mode::read&amp;gt;();&lt;/P&gt;&lt;P&gt;for (int y = 0; y &amp;lt; HEIGHT; ++y)&lt;BR /&gt;{&lt;BR /&gt;for (int x = 0; x &amp;lt; WIDTH; ++x) {&lt;BR /&gt;img[y][x] = host_acc[y][x];&lt;BR /&gt;if ((y &amp;lt; 5) &amp;amp;&amp;amp; (x &amp;lt; 5)) {&lt;BR /&gt;std::cout &amp;lt;&amp;lt; host_acc[y][x] &amp;lt;&amp;lt; ", ";&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;if (y &amp;lt; 5) {&lt;BR /&gt;std::cout &amp;lt;&amp;lt; "\n";&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;write_tga("JuliaUsingNDRANGE.tga");&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;void generateJuliaSetUSM(queue&amp;amp; Q)&lt;BR /&gt;{&lt;BR /&gt;// Allocate shared memory for the image&lt;BR /&gt;uint32_t* img = malloc_shared&amp;lt;uint32_t&amp;gt;(WIDTH * HEIGHT, Q);&lt;/P&gt;&lt;P&gt;Q.submit([&amp;amp;](handler&amp;amp; h) {&lt;BR /&gt;h.parallel_for(range&amp;lt;2&amp;gt;(HEIGHT, WIDTH), [=](id&amp;lt;2&amp;gt; idx) {&lt;BR /&gt;auto y = idx[0]; // Row&lt;BR /&gt;auto x = idx[1]; // Column&lt;BR /&gt;float left = -2.0, right = 2.0, top = 2.0, bottom = -2.0;&lt;BR /&gt;ComplexF z = { left + (right - left) * x / WIDTH, top + (bottom - top) * y / HEIGHT };&lt;BR /&gt;ComplexF c = { 0.285f, 0.01f }; // You can change these values for different Julia sets&lt;BR /&gt;int iterations = 0;&lt;BR /&gt;while (c_abs(z) &amp;lt; 2.0f &amp;amp;&amp;amp; iterations &amp;lt; MAX_ITERATIONS) {&lt;BR /&gt;z = c_add(c_mul(z, z), c);&lt;BR /&gt;iterations++;&lt;BR /&gt;}&lt;BR /&gt;if (iterations == MAX_ITERATIONS)&lt;BR /&gt;{&lt;BR /&gt;// z didn't escape from the circle.&lt;BR /&gt;// This point is in the Julia set.&lt;BR /&gt;img[y * WIDTH + x] = 0x000000; // black&lt;BR /&gt;}&lt;BR /&gt;else&lt;BR /&gt;{&lt;BR /&gt;uint8_t red = static_cast&amp;lt;uint8_t&amp;gt;(128.0f + cos(iterations * 0.15f) * 128.0f);&lt;BR /&gt;uint8_t green = static_cast&amp;lt;uint8_t&amp;gt;(128.0f + cos(iterations * 0.16f) * 128.0f);&lt;BR /&gt;uint8_t blue = static_cast&amp;lt;uint8_t&amp;gt;(128.0f + sin(iterations * 0.17f) * 128.0f);&lt;BR /&gt;img[y * WIDTH + x] = (red &amp;lt;&amp;lt; 16) | (green &amp;lt;&amp;lt; &lt;LI-EMOJI id="lia_smiling-face-with-sunglasses" title=":smiling_face_with_sunglasses:"&gt;&lt;/LI-EMOJI&gt; | blue;&lt;BR /&gt;}&lt;BR /&gt;});&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;Q.wait();&lt;/P&gt;&lt;P&gt;// Write the image to a file&lt;BR /&gt;write_tgaK9("JuliaUSM.tga", img);&lt;/P&gt;&lt;P&gt;// Free the shared memory&lt;BR /&gt;free(img, Q);&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;void generateJuliaSetBuffers(queue&amp;amp; Q)&lt;BR /&gt;{&lt;BR /&gt;// Allocate shared memory for the image&lt;BR /&gt;uint32_t* img = malloc_shared&amp;lt;uint32_t&amp;gt;(WIDTH * HEIGHT, Q);&lt;/P&gt;&lt;P&gt;buffer&amp;lt;uint32_t, 1&amp;gt; img_buf(img, range&amp;lt;1&amp;gt;(WIDTH * HEIGHT));&lt;/P&gt;&lt;P&gt;Q.submit([&amp;amp;](handler&amp;amp; h) {&lt;BR /&gt;auto img_acc = img_buf.get_access&amp;lt;access::mode::write&amp;gt;(h);&lt;BR /&gt;h.parallel_for(range&amp;lt;1&amp;gt;(WIDTH * HEIGHT), [=](id&amp;lt;1&amp;gt; idx) {&lt;BR /&gt;auto x = idx[0]; // Column&lt;BR /&gt;auto y = x / WIDTH; // Row&lt;BR /&gt;float left = -2.0, right = 2.0, top = 2.0, bottom = -2.0;&lt;BR /&gt;ComplexF z = { left + (right - left) * x / WIDTH, top + (bottom - top) * y / HEIGHT };&lt;BR /&gt;ComplexF c = { 0.285f, 0.01f }; // You can change these values for different Julia sets&lt;BR /&gt;int iterations = 0;&lt;BR /&gt;while (c_abs(z) &amp;lt; 2.0f &amp;amp;&amp;amp; iterations &amp;lt; MAX_ITERATIONS) {&lt;BR /&gt;z = c_add(c_mul(z, z), c);&lt;BR /&gt;iterations++;&lt;BR /&gt;}&lt;BR /&gt;if (iterations == MAX_ITERATIONS)&lt;BR /&gt;{&lt;BR /&gt;// z didn't escape from the circle.&lt;BR /&gt;// This point is in the Julia set.&lt;BR /&gt;img_acc[idx] = 0x000000; // black&lt;BR /&gt;}&lt;BR /&gt;else&lt;BR /&gt;{&lt;BR /&gt;uint8_t red = static_cast&amp;lt;uint8_t&amp;gt;(128.0f + cos(iterations * 0.15f) * 128.0f);&lt;BR /&gt;uint8_t green = static_cast&amp;lt;uint8_t&amp;gt;(128.0f + cos(iterations * 0.16f) * 128.0f);&lt;BR /&gt;uint8_t blue = static_cast&amp;lt;uint8_t&amp;gt;(128.0f + sin(iterations * 0.17f) * 128.0f);&lt;BR /&gt;img_acc[idx] = (red &amp;lt;&amp;lt; 16) | (green &amp;lt;&amp;lt; &lt;LI-EMOJI id="lia_smiling-face-with-sunglasses" title=":smiling_face_with_sunglasses:"&gt;&lt;/LI-EMOJI&gt; | blue;&lt;BR /&gt;}&lt;BR /&gt;});&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;Q.wait();&lt;/P&gt;&lt;P&gt;// Write the image to a file&lt;BR /&gt;write_tgaK9("JuliaBuffers.tga", img);&lt;/P&gt;&lt;P&gt;// Free the shared memory&lt;BR /&gt;free(img, Q);&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;int main()&lt;BR /&gt;{&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;queue Q;&lt;BR /&gt;selectDevice(Q);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;//std::cout &amp;lt;&amp;lt; "Device name: " &amp;lt;&amp;lt; Q.get_device().get_info&amp;lt;info::device::name&amp;gt;() &amp;lt;&amp;lt; "\n";&lt;BR /&gt;//std::cout &amp;lt;&amp;lt; "Device vendor: " &amp;lt;&amp;lt; Q.get_device().get_info&amp;lt;info::device::vendor&amp;gt;() &amp;lt;&amp;lt; "\n";&lt;BR /&gt;//std::cout &amp;lt;&amp;lt; "Device version: " &amp;lt;&amp;lt; Q.get_device().get_info&amp;lt;info::device::version&amp;gt;() &amp;lt;&amp;lt; "\n";&lt;BR /&gt;//std::cout &amp;lt;&amp;lt; "Device driver version: " &amp;lt;&amp;lt; Q.get_device().get_info&amp;lt;info::device::driver_version&amp;gt;() &amp;lt;&amp;lt; "\n";&lt;BR /&gt;//std::cout &amp;lt;&amp;lt; "Device global memory size: " &amp;lt;&amp;lt; Q.get_device().get_info&amp;lt;info::device::global_mem_size&amp;gt;() &amp;lt;&amp;lt; " bytes\n";&lt;BR /&gt;//std::cout &amp;lt;&amp;lt; "Device local memory size: " &amp;lt;&amp;lt; Q.get_device().get_info&amp;lt;info::device::local_mem_size&amp;gt;() &amp;lt;&amp;lt; " bytes\n";&lt;BR /&gt;//std::cout &amp;lt;&amp;lt; "Device max compute units: " &amp;lt;&amp;lt; Q.get_device().get_info&amp;lt;info::device::max_compute_units&amp;gt;() &amp;lt;&amp;lt; "\n";&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;//std::vector&amp;lt;uint32_t&amp;gt; data(HEIGHT * WIDTH);&lt;BR /&gt;//buffer&amp;lt;uint32_t, 2&amp;gt; img_buf(data.data(), range&amp;lt;2&amp;gt;(HEIGHT, WIDTH));&lt;/P&gt;&lt;P&gt;//// generate a Julia set, a type of fractal, in parallel on a selected device(CPU or GPU).&lt;BR /&gt;//auto start = the_clock::now();&lt;BR /&gt;//generateJuliaSet(Q, img_buf);&lt;BR /&gt;//auto end = the_clock::now();&lt;BR /&gt;//auto time_taken = duration_cast&amp;lt;milliseconds&amp;gt;(end - start).count();&lt;BR /&gt;//std::cout &amp;lt;&amp;lt; "using " &amp;lt;&amp;lt; Q.get_device().get_info&amp;lt;info::device::name&amp;gt;() &amp;lt;&amp;lt; " it took " &amp;lt;&amp;lt; time_taken &amp;lt;&amp;lt; " ms\n";&lt;BR /&gt;//&lt;BR /&gt;//// generate a Julia set using nd-range&lt;BR /&gt;//start = the_clock::now();&lt;BR /&gt;//generateJuliaSetNDRange(Q, img_buf);&lt;BR /&gt;//end = the_clock::now();&lt;BR /&gt;//time_taken = duration_cast&amp;lt;milliseconds&amp;gt;(end - start).count();&lt;BR /&gt;//std::cout &amp;lt;&amp;lt; "using " &amp;lt;&amp;lt; Q.get_device().get_info&amp;lt;info::device::name&amp;gt;() &amp;lt;&amp;lt; " it took " &amp;lt;&amp;lt; time_taken &amp;lt;&amp;lt; " ms\n";&lt;/P&gt;&lt;P&gt;std::cout &amp;lt;&amp;lt; "Parallel Mandelbrot set using USM.\n";&lt;BR /&gt;auto start = the_clock::now();&lt;BR /&gt;generateJuliaSetUSM(Q);&lt;BR /&gt;auto end = the_clock::now();&lt;BR /&gt;auto time_taken = duration_cast&amp;lt;milliseconds&amp;gt;(end - start).count();&lt;BR /&gt;std::cout &amp;lt;&amp;lt; "using " &amp;lt;&amp;lt; Q.get_device().get_info&amp;lt;info::device::name&amp;gt;() &amp;lt;&amp;lt; " it took " &amp;lt;&amp;lt; time_taken &amp;lt;&amp;lt; " ms\n";&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;std::cout &amp;lt;&amp;lt; "Parallel Mandelbrot set using USM.\n";&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;std::cout &amp;lt;&amp;lt; "Parallel Mandelbrot set using buffers.\n";&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;return 0;&lt;/P&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;&lt;BR /&gt;}&lt;/P&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;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Apr 2024 17:44:46 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/DPC-ERROR/m-p/1591944#M3669</guid>
      <dc:creator>andrew11111</dc:creator>
      <dc:date>2024-04-23T17:44:46Z</dc:date>
    </item>
    <item>
      <title>Re: DPC++ ERROR</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/DPC-ERROR/m-p/1593096#M3685</link>
      <description>&lt;P&gt;Can you please send your reproducer as an attachment? The code provided seems to have some problem and cannot be compiled.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 27 Apr 2024 07:10:14 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/DPC-ERROR/m-p/1593096#M3685</guid>
      <dc:creator>Alex_Y_Intel</dc:creator>
      <dc:date>2024-04-27T07:10:14Z</dc:date>
    </item>
  </channel>
</rss>

