<?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: No device error with vector_add sample in Intel® oneAPI DPC++/C++ Compiler</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/No-device-error-with-vector-add-sample/m-p/1330059#M1700</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;SPAN&gt;Ditipriya,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;thanks for your reply. I reinstalled windows10, VS2019 and oneAPI and I'm one step further. If I run the VectorAdd sample&amp;nbsp; I see now this:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Running on device: Intel(R) Graphics [0x3e98]&lt;BR /&gt;Vector size: 10000&lt;BR /&gt;Vector add failed on device.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;switching to OpenCL using&amp;nbsp;&lt;STRONG&gt;SYCL_DEVICE_FILTER=opencl:cpu&lt;/STRONG&gt; the printed result is different:&lt;/P&gt;
&lt;P&gt;Running on device: Intel(R) Core(TM) i9-9900K CPU @ 3.60GHz&lt;BR /&gt;Vector size: 10000&lt;BR /&gt;dummy: error: cannot open output file R:\Temp\OpenCLKernel-43e20f.dll: function not supported&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Drive R is my Ramdrive with 6GB free space.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Daniel&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>Mon, 15 Nov 2021 11:46:20 GMT</pubDate>
    <dc:creator>Daniel_D</dc:creator>
    <dc:date>2021-11-15T11:46:20Z</dc:date>
    <item>
      <title>No device error with vector_add sample</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/No-device-error-with-vector-add-sample/m-p/1329414#M1698</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I created a new DPC++ project (vector_add) with the VS2019 wizzad. When debug it I get an exception when the queue is created, saying that no device is available.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is the function causing the exception:&lt;/P&gt;
&lt;PRE&gt;queue create_device_queue() {&lt;BR /&gt;// create device selector for the device of your interest&lt;BR /&gt;#ifdef FPGA_EMULATOR&lt;BR /&gt;// DPC++ extension: FPGA emulator selector on systems without FPGA card&lt;BR /&gt;ext::intel::fpga_emulator_selector dselector;&lt;BR /&gt;#elif defined(FPGA)&lt;BR /&gt;// DPC++ extension: FPGA selector on systems with FPGA card&lt;BR /&gt;ext::intel::fpga_selector dselector;&lt;BR /&gt;#else&lt;BR /&gt;// the default device selector: it will select the most performant device&lt;BR /&gt;// available at runtime.&lt;BR /&gt;default_selector dselector;   // also tried cpu_selector and gpu_selector - always the same exception&lt;BR /&gt;#endif&lt;BR /&gt;&lt;BR /&gt;try {&lt;BR /&gt;// create the devices queue with the selector above and the exception&lt;BR /&gt;// handler to catch async runtime errors the device queue is used to enqueue&lt;BR /&gt;// the kernels and encapsulates all the states needed for execution&lt;BR /&gt;&lt;STRONG&gt;queue q(dselector, ehandler); // EXCEPTION HAPPENS HERE&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;return q;&lt;BR /&gt;}&lt;BR /&gt;catch (const sycl::exception&amp;amp; e) {&lt;BR /&gt;// catch the exception from devices that are not supported.&lt;BR /&gt;std::cerr &amp;lt;&amp;lt; "An exception is caught when creating a device queue."&lt;BR /&gt;&amp;lt;&amp;lt; std::endl;&lt;BR /&gt;std::cerr &amp;lt;&amp;lt; EXCEPTION_MSG;&lt;BR /&gt;std::terminate();&lt;BR /&gt;}&lt;BR /&gt;}&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The contents of the exception message is:&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;No device of requested type available. Please check &lt;A href="https://software.intel.com/content/www/us/en/develop/articles/intel-oneapi-dpcpp-system-requirements.html" target="_blank" rel="noopener"&gt;https://software.intel.com/content/www/us/en/develop/articles/intel-oneapi-dpcpp-system-requirements.html&lt;/A&gt; -1 (CL_DEVICE_NOT_FOUND)&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My hardware configuration is:&lt;/P&gt;
&lt;DIV class="device-component-title-container"&gt;
&lt;H4&gt;Intel® Core™ i9-9900K CPU @ 3.60GHz with 32GB RAM and 6GB available&lt;/H4&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I also tried the console application, but this one failed to compile:&lt;BR /&gt;&lt;BR /&gt;Rebuild started...&lt;BR /&gt;1&amp;gt;------ Rebuild All started: Project: DPCPPConsoleApplication1, Configuration: Debug x64 ------&lt;BR /&gt;1&amp;gt;llvm-objcopy.exe: : error : 'x64\\Debug\\DPCPPConsoleApplication1.obj': function not supported&lt;BR /&gt;1&amp;gt;C:\PROGRA~2\Intel\oneAPI\compiler\20214~1.0\windows\bin\clang-offload-bundler: : error : 'llvm-objcopy' tool failed&lt;BR /&gt;1&amp;gt;dpcpp: : error : clang-offload-bundler command failed with exit code 1 (use -v to see invocation)&lt;BR /&gt;1&amp;gt;Done building project "DPCPPConsoleApplication1.vcxproj" -- FAILED.&lt;BR /&gt;========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========&lt;BR /&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;Any idea how I can get the sample to work?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;Daniel&lt;/P&gt;
&lt;/DIV&gt;</description>
      <pubDate>Fri, 12 Nov 2021 17:17:30 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/No-device-error-with-vector-add-sample/m-p/1329414#M1698</guid>
      <dc:creator>Daniel_D</dc:creator>
      <dc:date>2021-11-12T17:17:30Z</dc:date>
    </item>
    <item>
      <title>Re: No device error with vector_add sample</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/No-device-error-with-vector-add-sample/m-p/1330055#M1699</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;&amp;gt;&amp;gt;&lt;I&gt;No device of requested type available. Please check &lt;A href="https://software.intel.com/content/www/us/en/develop/articles/intel-oneapi-dpcpp-system-requirements" target="_blank" rel="noopener"&gt;https://software.intel.com/content/www/us/en/develop/articles/intel-oneapi-dpcpp-system-requirements&lt;/A&gt;... -1 (CL_DEVICE_NOT_FOUND)&lt;/I&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You will get an exception if the filtered list of devices does not include a device that satisfies the selector.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;gt;&amp;gt; &lt;I&gt;How I can get the sample to work?&lt;/I&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Could you please try changing your backend to OpenCL on VS as mentioned below:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The Path is as follows - Go to project properties &amp;gt; Debugging &amp;gt; Environment &amp;gt; Click on Edit &amp;gt; Type the value of the environment variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Value of Environment variable - &lt;STRONG&gt;SYCL_DEVICE_FILTER=opencl:cpu&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then try rebuilding.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please do let us know if this helps resolve your issue.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks &amp;amp; Regards,&lt;/P&gt;
&lt;P&gt;Ditipriya.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Dec 2021 05:20:23 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/No-device-error-with-vector-add-sample/m-p/1330055#M1699</guid>
      <dc:creator>DitiD_Intel</dc:creator>
      <dc:date>2021-12-15T05:20:23Z</dc:date>
    </item>
    <item>
      <title>Re: No device error with vector_add sample</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/No-device-error-with-vector-add-sample/m-p/1330059#M1700</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;SPAN&gt;Ditipriya,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;thanks for your reply. I reinstalled windows10, VS2019 and oneAPI and I'm one step further. If I run the VectorAdd sample&amp;nbsp; I see now this:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Running on device: Intel(R) Graphics [0x3e98]&lt;BR /&gt;Vector size: 10000&lt;BR /&gt;Vector add failed on device.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;switching to OpenCL using&amp;nbsp;&lt;STRONG&gt;SYCL_DEVICE_FILTER=opencl:cpu&lt;/STRONG&gt; the printed result is different:&lt;/P&gt;
&lt;P&gt;Running on device: Intel(R) Core(TM) i9-9900K CPU @ 3.60GHz&lt;BR /&gt;Vector size: 10000&lt;BR /&gt;dummy: error: cannot open output file R:\Temp\OpenCLKernel-43e20f.dll: function not supported&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Drive R is my Ramdrive with 6GB free space.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Daniel&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>Mon, 15 Nov 2021 11:46:20 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/No-device-error-with-vector-add-sample/m-p/1330059#M1700</guid>
      <dc:creator>Daniel_D</dc:creator>
      <dc:date>2021-11-15T11:46:20Z</dc:date>
    </item>
    <item>
      <title>Re: No device error with vector_add sample</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/No-device-error-with-vector-add-sample/m-p/1336845#M1703</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Could you please try executing this sample code for vector add on oneAPI command prompt.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sample Code:&amp;nbsp;&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;
#include &amp;lt;vector&amp;gt;
#include &amp;lt;iostream&amp;gt;

#include &amp;lt;CL/sycl/INTEL/fpga_extensions.hpp&amp;gt;


using namespace sycl;

// Vector type and data size for this example.
size_t vector_size = 10000;
typedef std::vector&amp;lt;int&amp;gt; IntVector;

// Create an exception handler for asynchronous SYCL exceptions
static auto exception_handler = [](sycl::exception_list e_list) {
    for (std::exception_ptr const&amp;amp; e : e_list) {
        try {
            std::rethrow_exception(e);
        }
        catch (std::exception const&amp;amp; e) {
#if _DEBUG
            std::cout &amp;lt;&amp;lt; "Failure" &amp;lt;&amp;lt; std::endl;
#endif
            std::terminate();
        }
    }
};

//************************************
// Vector add in DPC++ on device: returns sum in 4th parameter "sum_parallel".
//************************************
void VectorAdd(queue&amp;amp; q, const IntVector&amp;amp; a_vector, const IntVector&amp;amp; b_vector,
    IntVector&amp;amp; sum_parallel) {
    // Create the range object for the vectors managed by the buffer.
    range&amp;lt;1&amp;gt; num_items{ a_vector.size() };

    // Create buffers that hold the data shared between the host and the devices.
    // The buffer destructor is responsible to copy the data back to host when it
    // goes out of scope.
    buffer a_buf(a_vector);
    buffer b_buf(b_vector);
    buffer sum_buf(sum_parallel.data(), num_items);

    // Submit a command group to the queue by a lambda function that contains the
    // data access permission and device computation (kernel).
    q.submit([&amp;amp;](handler&amp;amp; h) {
        // Create an accessor for each buffer with access permission: read, write or
        // read/write. The accessor is a mean to access the memory in the buffer.
        accessor a(a_buf, h, read_only);
        accessor b(b_buf, h, read_only);

        // The sum_accessor is used to store (with write permission) the sum data.
        accessor sum(sum_buf, h, write_only, no_init);

        // Use parallel_for to run vector addition in parallel on device. This
        // executes the kernel.
        //    1st parameter is the number of work items.
        //    2nd parameter is the kernel, a lambda that specifies what to do per
        //    work item. The parameter of the lambda is the work item id.
        // DPC++ supports unnamed lambda kernel by default.
        h.parallel_for(num_items, [=](auto i) { sum[i] = a[i] + b[i]; });
        });
}

//************************************
// Initialize the vector from 0 to vector_size - 1
//************************************
void InitializeVector(IntVector&amp;amp; a) {
    for (size_t i = 0; i &amp;lt; a.size(); i++) a.at(i) = i;
}

//************************************
// Demonstrate vector add both in sequential on CPU and in parallel on device.
//************************************
int main(int argc, char* argv[]) {
    // Change vector_size if it was passed as argument
    if (argc &amp;gt; 1) vector_size = std::stoi(argv[1]);
  
    cpu_selector d_selector;


    // Create vector objects with "vector_size" to store the input and output data.
    IntVector a, b, sum_sequential, sum_parallel;
    a.resize(vector_size);
    b.resize(vector_size);
    sum_sequential.resize(vector_size);
    sum_parallel.resize(vector_size);

    // Initialize input vectors with values from 0 to vector_size - 1
    InitializeVector(a);
    InitializeVector(b);

    try {
        queue q(d_selector, exception_handler);

        // Print out the device information used for the kernel code.
        std::cout &amp;lt;&amp;lt; "Running on device: "
            &amp;lt;&amp;lt; q.get_device().get_info&amp;lt;info::device::name&amp;gt;() &amp;lt;&amp;lt; "\n";
        std::cout &amp;lt;&amp;lt; "Vector size: " &amp;lt;&amp;lt; a.size() &amp;lt;&amp;lt; "\n";

        // Vector addition in DPC++
        VectorAdd(q, a, b, sum_parallel);
    }
    catch (exception const&amp;amp; e) {
        std::cout &amp;lt;&amp;lt; "An exception is caught for vector add.\n";
        std::terminate();
    }

    // Compute the sum of two vectors in sequential for validation.
    for (size_t i = 0; i &amp;lt; sum_sequential.size(); i++)
        sum_sequential.at(i) = a.at(i) + b.at(i);

    // Verify that the two vectors are equal.  
    for (size_t i = 0; i &amp;lt; sum_sequential.size(); i++) {
        if (sum_parallel.at(i) != sum_sequential.at(i)) {
            std::cout &amp;lt;&amp;lt; "Vector add failed on device.\n";
            return -1;
        }
    }

    int indices[]{ 0, 1, 2, (static_cast&amp;lt;int&amp;gt;(a.size()) - 1) };
    constexpr size_t indices_size = sizeof(indices) / sizeof(int);

    // Print out the result of vector add.
    for (int i = 0; i &amp;lt; indices_size; i++) {
        int j = indices[i];
        if (i == indices_size - 1) std::cout &amp;lt;&amp;lt; "...\n";
        std::cout &amp;lt;&amp;lt; "[" &amp;lt;&amp;lt; j &amp;lt;&amp;lt; "]: " &amp;lt;&amp;lt; a[j] &amp;lt;&amp;lt; " + " &amp;lt;&amp;lt; b[j] &amp;lt;&amp;lt; " = "
            &amp;lt;&amp;lt; sum_parallel[j] &amp;lt;&amp;lt; "\n";
    }

    a.clear();
    b.clear();
    sum_sequential.clear();
    sum_parallel.clear();

    std::cout &amp;lt;&amp;lt; "Vector add successfully completed on device.\n";
    return 0;
}&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;In case the code is creating a similar kind of issue, please provide us with the logs by setting the command mentioned below and finally run the executable.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;set SYCL_PI_TRACE=2&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks &amp;amp; Regards,&lt;/P&gt;
&lt;P&gt;Ditipriya.&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>Wed, 17 Nov 2021 05:39:01 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/No-device-error-with-vector-add-sample/m-p/1336845#M1703</guid>
      <dc:creator>DitiD_Intel</dc:creator>
      <dc:date>2021-11-17T05:39:01Z</dc:date>
    </item>
    <item>
      <title>Re: No device error with vector_add sample</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/No-device-error-with-vector-add-sample/m-p/1338815#M1707</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We have not heard back from you. Could you please provide an update?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks &amp;amp; Regards,&lt;/P&gt;
&lt;P&gt;Ditipriya.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Dec 2021 05:24:56 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/No-device-error-with-vector-add-sample/m-p/1338815#M1707</guid>
      <dc:creator>DitiD_Intel</dc:creator>
      <dc:date>2021-12-15T05:24:56Z</dc:date>
    </item>
    <item>
      <title>Re:No device error with vector_add sample</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/No-device-error-with-vector-add-sample/m-p/1340140#M1712</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;We have not heard back from you. This thread will no longer be monitored by Intel. If you need further assistance, please post a new question.&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;Ditipriya.&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 30 Nov 2021 06:02:30 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/No-device-error-with-vector-add-sample/m-p/1340140#M1712</guid>
      <dc:creator>DitiD_Intel</dc:creator>
      <dc:date>2021-11-30T06:02:30Z</dc:date>
    </item>
  </channel>
</rss>

