Forum Discussion

cagxel's avatar
cagxel
Icon for New Contributor rankNew Contributor
2 years ago
Solved

PI_ERROR_DEVICE_NOT_AVAILABLE while executing/debugging FPGA_Compile example on EMULATOR

Hello,

I am trying to compile and debug the SYCL++_FPGA examples on Github. I am getting following error when I try to compile for emulator.

Caught a SYCL host exception:
Native API failed. Native API returns: -2 (PI_ERROR_DEVICE_NOT_AVAILABLE) -2 (PI_ERROR_DEVICE_NOT_AVAILABLE)
terminate called after throwing an instance of 'sycl::_V1::runtime_error'
  what():  Native API failed. Native API returns: -2 (PI_ERROR_DEVICE_NOT_AVAILABLE) -2 (PI_ERROR_DEVICE_NOT_AVAILABLE)
Aborted (core dumped)

However once I make and execute for simulation I get no problem and it somehow also fixes the problem for Emulator. You can find the step by step execution in the screenshot. I also get the same error when I try to check devices.

sycl-ls

However, as you can see from the screenshot, executing for simulation also fixes this.

Even executing simulation fixes this issue for the exe, I still get the same error when I try to debug the code, I still get the same error for the device selector queue. Mainly for this part:

 sycl::queue q(selector);

I tried with both -DCMAKE_BUILD_TYPE=Debug flag and without it. I also tried same steps for FPGA_Template example but exactly same thing happens. Any help is appreciated.

  • Hello, I was able to solve the problem,

    Turns out setting the variable CL_CONTEXT_MPSIM_DEVICE_INTELFPGA causes problems with emulation and debugging. Unsetting this variable fixed my problem.

9 Replies

  • Hi @cagxel,


    Thank you for posting in Intel community forum and hope all is well.

    Noted on the error mention for the emulation build. It seems to be indicating that there is error in the device it is trying to compile with.


    May I know which OS the host machine that you are using to build this with?

    And to confirm the version used are 2024.2? And is there any changes to the cmake files?

    Hope to hear from you soon.


    Best Wishes

    BB


    • cagxel's avatar
      cagxel
      Icon for New Contributor rankNew Contributor

      Hello, thank you for your response. I been using GCC version 13.2.0, Quartus Prime and OneAPI version 24.2 with FPGA support package installed on Ubuntu 24.04.1 LTS when I was doing the steps I mentioned in my post. I didn't make any changes to the files on Github repository. Unfortunately my problem persists.

      • cagxel's avatar
        cagxel
        Icon for New Contributor rankNew Contributor

        I just ran the OneAPI diagnostic tool and I get the following error

        Check name: dpcpp_compiler_sys_check
        Description: This check verifies if the environment is ready to use the Intel(R) oneAPI DPC++ Compiler.
        Result status: FAIL
        Intel(R) oneAPI DPC++ Compiler requires gcc version 5.1 or higher.
        Warning: INTEL_FPGA_ROOT is not set. Warning: Open Programmable Acceleration Engine (OPAE) driver was not found. 

        However, my pc is using gcc version 13.2.0 and I couldn't find any information on forum or the oneAPI documentation regarding how to set INTEL_FPGA_ROOT. In addition to that there are bunch of "gcc4.8" directories inside oneAPI installation directory that is installed with basekit.


  • Hi @cagxel,


    Greetings, just checking in to see if there is any further doubts in regards to this matter.

    Hope your doubts have been clarified.


    Best Wishes

    BB


  • Hi @cagxel,


    Noted on the GCC version, and yea it should be meeting the requirement.

    Based on the error message it seems that some library are not being source correctly.

    Would suggest to source the 'setvars.sh' (usually in the oneapi installation path) to set the correct library.

    After that you can run the 'fpga_sys_check.sh' to check on the env settings to confirm.

    Hope that clarify.


    Best Wishes

    BB



  • Hi @cagxel,


    Good day, just following up on the previous clarification.

    By any chances did you managed to look into it?

    Hope to hear from you soon.


    Best Wishes

    BB


  • cagxel's avatar
    cagxel
    Icon for New Contributor rankNew Contributor

    Hello, I was able to solve the problem,

    Turns out setting the variable CL_CONTEXT_MPSIM_DEVICE_INTELFPGA causes problems with emulation and debugging. Unsetting this variable fixed my problem.

  • Hi @cagxel,


    Good to know that issues has been overcome, with no further clarification on this thread, it will be transitioned to community support for further help on doubts in this thread. Please login to ‘https://supporttickets.intel.com’, view details of the desire request, and post a feed/response within the next 15 days to allow me to continue to support you. After 15 days, this thread will be transitioned to community support.

    Thank you for the questions and as always pleasure having you here.


    Best Wishes

    BB