Intel® High Level Design
Support for Intel® High Level Synthesis Compiler, DSP Builder, OneAPI for Intel® FPGAs, Intel® FPGA SDK for OpenCL™
697 Discussions

oneAPI on Cyclone10gx

StefanoC
Novice
8,285 Views

Hi all,

the official Intel fpga requirement page says the Cyclone10gx fpga is supported by oneAPI so I downloaded the latest version on my Ubuntu20 (Quartus Prime also installed), I tried to compile a sample-adder, the compiler (targeting the fpga) works but then when I run simple-add-buffer.fpga I get:

 

tetto@ubuntuoffice:~/simple-add/build$ ./simple-add-buffers.fpga
An exception is caught while computing on device.
terminate called after throwing an instance of 'sycl::_V1::runtime_error'
what(): No device of requested type available. Please check https://software.intel.com/content/www/us/en/develop/articles/intel-oneapi-dpcpp-system-requirements.html -1 (PI_ERROR_DEVICE_NOT_FOUND)
Aborted (core dumped)

 

 

0 Kudos
43 Replies
BoonBengT_Intel
Moderator
4,615 Views

Hi @StefanoC,


Thank you for posting in Intel community forum on your interest in oneAPI and hope all is well.

If I understand the situation correctly it seems that you are trying to run the hardware compilation in the IP authoring flow, and based on the error message it complaining that device not found.

Hence suspecting that the command line used might be incorrect, for that you may refer to the compilation flags below:

- https://www.intel.com/content/www/us/en/docs/oneapi/programming-guide/2023-2/fpga-compilation-flags.html

Hope that clarify


Best Wishes

BB


0 Kudos
StefanoC
Novice
4,612 Views

I was following this:

https://www.intel.com/content/www/us/en/docs/oneapi-base-toolkit/get-started-guide-linux/2024-0/run-a-sample-project-using-the-command-line.html

 

and indeed I can compile with make (both emulation and fpga), the issue I experience is at runtime, when I try to execute the  ./simple-add-buffers.fpga (previously I had issued cmake .. -DFPGA_DEVICE=cyclone10gx to really target my device).

 

Overall, I have a dual boot computer with windows10/ubuntu, on windows10 I was able to compile and download a sample vhdl to the fpga, so I am sure the board is powered ok/jtag cable is ok too, I am wondering if on ubuntu any additional driver/os related has to be installed. At the moment I have quartus prime (licence is ok) and oneAPI (on both windows10 and ubuntu). I would prefer Linux as I am more comfortable with command line, but I think I am missing something how to get the Cyclone 10gx board properly installed (my understanding was Quartus prime pro contains the cyclone10 driver..), what should I check to make sure my fpga is configured properly on my linux system?

 

thanks!

0 Kudos
StefanoC
Novice
4,536 Views

 

 

 

I am trying to compile and run this sample code:

#include <CL/sycl.hpp>
#include <iostream>
#include <sycl/ext/intel/fpga_extensions.hpp>

using namespace cl::sycl;

int main() {
    auto selector = sycl::ext::intel::fpga_selector_v;
    queue q(selector);

    const int N = 100;
    int a[N], b[N], c[N];

    // Initialize arrays on the host
    for (int i = 0; i < N; i++) {
        a[i] = i;
        b[i] = i * 2;
    }

    buffer<int, 1> buf_a(a, range<1>(N));  // Create buffers for arrays
    buffer<int, 1> buf_b(b, range<1>(N));
    buffer<int, 1> buf_c(c, range<1>(N));

    q.submit([&](handler& h) {
        auto a_acc = buf_a.get_access<access::mode::read>(h);
        auto b_acc = buf_b.get_access<access::mode::read>(h);
        auto c_acc = buf_c.get_access<access::mode::write>(h);

        h.parallel_for(range<1>(N), [=](id<1> i) {
            c_acc[i] = a_acc[i] + b_acc[i];  // Perform element-wise addition
        });
    });

    q.wait();  // Wait for completion

    // Print results on the host
    for (int i = 0; i < N; i++) {
        std::cout << c[i] << " ";
    }
    std::cout << std::endl;

    return 0;
}

 

 

 

 following your link/suggestion I did add the proper flags (see below), I also made sure the board is seen by the OS but I still get the following runtime error:

 

 

 

tetto@ubuntuoffice:~/mytrial1$ jtagconfig
1) USB-BlasterII [1-1]
  031820DD   10M08SA(.|ES)/10M08S(C|L)
  02E120DD   10CX220Y

tetto@ubuntuoffice:~/mytrial1$ icpx -fsycl -fintelfpga fpga_add2.cpp -Xshardware -Xstarget=Cyclone10GX -o fpga_compile.>aoc: Compiling for FPGA. This process may take several hours to complete.  Prior to performing this compile, be sure to>

tetto@ubuntuoffice:~/mytrial1$ ./fpga_compile.fpga
terminate called after throwing an instance of 'sycl::_V1::runtime_error'
  what():  Invalid device program image: size is zero -30 (PI_ERROR_INVALID_VALUE)
Aborted (core dumped)

 

 

 

 

0 Kudos
BoonBengT_Intel
Moderator
4,497 Views

Hi @StefanoC,


Appreciate and noted on the sample code used, as well as the checking on the board connection to windows 10 host.

Also noted Ubuntu, you have run the command jtagconfig to check on the connect to board.


Further question, may I know what is the what are the quartus prime pro version and oneapi version that you have?

Hope to hear from you soon.


Best Wishes

BB


0 Kudos
StefanoC
Novice
4,487 Views

latest version of oneAPI:

tetto@ubuntuoffice:~/mytrial1$ icpx --version
Intel(R) oneAPI DPC++/C++ Compiler 2024.0.2 (2024.0.2.20231213)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /opt/intel/oneapi/compiler/2024.0/bin/compiler
Configuration file: /opt/intel/oneapi/compiler/2024.0/bin/compiler/../icpx.cfg

 I have both artus 23.4 (I know not compatible/supported by oneAPI latest yet) and Quartus 23.1 (this should be compatible). My licence is Pro, here is my .bashrc file (do I miss anything there?)

export QSYS_ROOTDIR="/home/tetto/intelFPGA_pro/23.1/qsys/bin"
export QUARTUS_ROOTDIR_OVERRIDE=/home/tetto/intelFPGA_pro/23.1/quartus
export LD_LIBRARY_PATH=~/intelFPGA_pro/23.1/quartus/linux64:$LD_LIBRARY_PATH
export CL_CONTEXT_MPSIM_DEVICE_INTELFPGA=1
export PATH=$PATH:/home/tetto/intelFPGA_pro/23.1/quartus/bin/
export INTELFPGAOCLSDKROOT="/home/tetto/intelFPGA_pro/23.1/hld"

 

p.s. It just occurred to me, that my machine CPU is non Intel (AMD Ryzen Threadripper 3960X 24-Core Processor), I would think that not an issue, isn't it?

0 Kudos
BoonBengT_Intel
Moderator
4,436 Views

Hi @StefanoC,


Noted on the oneapi and quartus version used. Allow us sometime to try to reproduce the issues from our end.

While waiting, can you please run the aocl diagnose command to check on the board initialization on the environment and share the output here.

Hope to hear from you soon.


Best Wishes

BB


0 Kudos
StefanoC
Novice
4,414 Views

tetto@ubuntuoffice:~$ aocl diagnose
--------------------------------------------------------------------
ICD System Diagnostics
--------------------------------------------------------------------

Using the following location for ICD installation:
/etc/OpenCL/vendors

Found 3 icd entry at that location:
/etc/OpenCL/vendors/Altera.icd
/etc/OpenCL/vendors/Intel_FPGA_SSG_Emulator.icd
/etc/OpenCL/vendors/intel64.icd

The following OpenCL libraries are referenced in the icd files:
/opt/intel/oneapi/compiler/latest/opt/oclfpga/host/linux64/lib/libalteracl.so

Checking LD_LIBRARY_PATH for registered libraries:
/opt/intel/oneapi/compiler/latest/opt/oclfpga/host/linux64/lib/libalteracl.so was registered on the system.
/opt/intel/oneapi/compiler/latest/lib/libintelocl_emu.so

Checking LD_LIBRARY_PATH for registered libraries:
/opt/intel/oneapi/compiler/latest/lib/libintelocl_emu.so was registered on the system.
/opt/intel/oneapi/compiler/latest/lib/libintelocl.so

Checking LD_LIBRARY_PATH for registered libraries:
/opt/intel/oneapi/compiler/latest/lib/libintelocl.so was registered on the system.

Using OCL_ICD_FILENAMES to search for ICD clients, it is set to libintelocl_emu.so:libalteracl.so:/opt/intel/oneapi/compiler/2024.0/lib/libintelocl.so

Checking LD_LIBRARY_PATH for registered libraries specified by OCL_ICD_FILENAMES
libintelocl_emu.so was registered on the system at /opt/intel/oneapi/compiler/2024.0/lib
libalteracl.so was registered on the system at /opt/intel/oneapi/compiler/2024.0/opt/oclfpga/host/linux64/lib
/opt/intel/oneapi/compiler/2024.0/lib/libintelocl.so was registered on the system.

Using the following location for fcd installations:
/opt/Intel/OpenCLFPGA/oneAPI/Boards

ERROR: No FCD entry at that location. Without ICD and FCD, host executables
must be linked directly to Intel FPGA runtime (libalteracl.so) and BSP MMD
library instead of to the Khronos ICD library (libOpenCL.so).
To use FCD, please reinstall using 'aocl install'.
--------------------------------------------------------------------
ICD diagnostics FAILED
--------------------------------------------------------------------
--------------------------------------------------------------------
BSP Diagnostics
--------------------------------------------------------------------
/opt/intel/oneapi/compiler/2024.0/opt/oclfpga/board/intel_a10gx_pac/linux64/libexec/diagnose: error while loading shared libraries: libopae-c.so.1: cannot open shared object file: No such file or directory
--------------------------------------------------------------------
Warning:
No devices attached for package:
/opt/intel/oneapi/compiler/2024.0/opt/oclfpga/board/intel_a10gx_pac
--------------------------------------------------------------------
/opt/intel/oneapi/compiler/2024.0/opt/oclfpga/board/intel_a10gx_pac/linux64/libexec/diagnose: error while loading shared libraries: libopae-c.so.1: cannot open shared object file: No such file or directory
--------------------------------------------------------------------

Call "aocl diagnose <device-names>" to run diagnose for specified devices
Call "aocl diagnose all" to run diagnose for all devices

0 Kudos
BoonBengT_Intel
Moderator
4,348 Views

Hi @StefanoC,


Reviewing through the diagnose output it make sense for the failure as it is complaining about the missing BSP for PAC related product.

In our case, targetted device are not PAC but C10GX, hence we can omit the error for now.

We are still working on the example provided and will get back at earliest.


Best Wishes

BB


0 Kudos
BoonBengT_Intel
Moderator
3,377 Views

Hi @StefanoC,


Greetings, to update the compilation flag are able to be completed successfully from our end. Hence suspecting that just the compilation flag that are causing the error. Notice that the used compilation are obselete, please use the xstarget instead.

Hope that clarify.


Best Wishes

BB



0 Kudos
StefanoC
Novice
3,369 Views

not sure I understand what you wrote, did you try to compile using the same compilation flags I used? If you are successful then the issue is not the compilation flag but some libraries or environment variable? You mention xstarget, is there any documentation?

0 Kudos
BoonBengT_Intel
Moderator
3,367 Views

Hi @StefanoC,


Recall that previously there was a mention the use of -DFPGA_DEVICE for the compilation command.

However that flag might be obsolete and suspect it might cause some problem.

Hence would suggest to use the -Xstarget instead, more details can be found in the link below:

- https://www.intel.com/content/www/us/en/docs/oneapi/programming-guide/2023-0/fpga-compilation-flags.html


Best Wishes

BB


0 Kudos
StefanoC
Novice
3,343 Views

If you review my post on ‎12-31-2023 10:18 PM I had used that very same compilation flag with the very same syntax as in the online document you posted, I add here below the line I had used on ‎12-31-2023 10:18 PM (that fails at runtime):

 

tetto@ubuntuoffice:~/mytrial1$ icpx -fsycl -fintelfpga fpga_add2.cpp -Xshardware -Xstarget=Cyclone10GX -o fpga_compile.>aoc: Compiling for FPGA. This process may take several hours to complete.  Prior to performing this compile, be sure to>

tetto@ubuntuoffice:~/mytrial1$ ./fpga_compile.fpga
terminate called after throwing an instance of 'sycl::_V1::runtime_error'
  what():  Invalid device program image: size is zero -30 (PI_ERROR_INVALID_VALUE)
Aborted (core dumped)

 

 


@BoonBengT_Intel wrote:

Hi @StefanoC,

 

Recall that previously there was a mention the use of -DFPGA_DEVICE for the compilation command.

However that flag might be obsolete and suspect it might cause some problem.

Hence would suggest to use the -Xstarget instead, more details can be found in the link below:

- https://www.intel.com/content/www/us/en/docs/oneapi/programming-guide/2023-0/fpga-compilation-flags.html

 

Best Wishes

BB





0 Kudos
BoonBengT_Intel
Moderator
3,192 Views

Hi @StefanoC,

 

Apologies for the confusion and missing the previous comment on mentioning the param used of -Xstarget.

The previous use of -DFPGA_DEVICE usually are example with the makefile, hence that param are used.

I tried to run the emulation for the code provided and it was completed successfully. (with some modification on line #8)

BoonBengT_Intel_0-1706765000688.png

 

Followed by full hardware compilation which is also completed successfully.

Perhap you can try to compile with the following command form your end:

- icpx -fsycl -fintelfpga -Xshardware -Xstarget=Cyclone10GX code.cpp -o code.fpga

 

Also, just to eliminate the possibilities of code issues. Would suggest perhaps to try run the existing example available for oneAPI in the link below:

- https://github.com/oneapi-src/oneAPI-samples/tree/release/2023.2/DirectProgramming/C%2B%2BSYCL_FPGA/Tutorials

 

Hope that clarify.

 

Best Wishes

BB

 

0 Kudos
StefanoC
Novice
3,172 Views

@BoonBengT_Intel  on my end still same error:

 

tetto@ubuntuoffice:~/mytrial1$ ./code.fpga
terminate called after throwing an instance of 'sycl::_V1::runtime_error'
  what():  Invalid device program image: size is zero -30 (PI_ERROR_INVALID_VALUE)
Aborted (core dumped)

 

 what did you modify on line8? can you share your code that you got it to run?

0 Kudos
BoonBengT_Intel
Moderator
3,161 Views

Hi @StefanoC,


For the emulation to be successful you can change the link #8 as below:

(from) auto selector = sycl::ext::intel::fpga_selector_v;

(to) auto selector = sycl::ext::intel::fpga_emulator_selector_v;


And compile with the emulation command: icpx -fsycl -fintelfpga code.cpp -o code-compile.fpga_emu

Perhaps would suggest to run a simple vector example instead to narrow down if it is hardware connectino issues.

Hope that carify


Regards

BB


0 Kudos
StefanoC
Novice
3,156 Views

changing that line8 into emulation results in this runtime error:

tetto@ubuntuoffice:~/mytrial1$ ./code-compile.fpga_emu
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)
tetto@ubuntuoffice:~/mytrial1$

 however, on your end why did you switch to emulation? Does it work on the real fpga hardware without emulation? 

the github repository you pointed is full of codes, but in all the README files I can read I never see Cyclone 10GX as supported, so now I am puzzled. Can you point a simple example that is tested on the Cyclone10 GX (hardware compilation)?

 

Since you can run (at least the emulation) my sample code while I get an error even with simulation I would think my setup has an issue, is there any library/settings to be checked? Ultimately, on your end, if you turn line8 the way it was, does it work at runtime?

0 Kudos
BoonBengT_Intel
Moderator
3,033 Views

Hi @StefanoC,

 

Just to clarify the emulation failed even with the compilation command above with the '-Xshardware'?

Kinda weird, yes from my end it does work however with a different hardware setup.

 

Hence just to narrow down the issues here, you can try running the simple example below to check on the overall setup:

- https://github.com/oneapi-src/oneAPI-samples/tree/master/DirectProgramming/C%2B%2BSYCL_FPGA/Tutorials/GettingStarted/fpga_compile

 

As for library checking the previous aocl diagnose command does so, based on the output suggested it seems that the version and library should be ok.

 

Note: attached is the aocl output from my setup as references.

 

Best Wishes

BB

 

0 Kudos
StefanoC
Novice
3,000 Views

Ok, I gave it a try to the part1. I was able to compile and run it via emulation, but when I tried the cmake with -DFPGA_DEVICE setting to "Cylone10gx" it said "Ignoring as not applicable" (I also tried Cyclone, CycloneGX), how to target my hardware and run it hardware rather than emulated?

tetto@ubuntuoffice:~/oneAPI-samples/DirectProgramming/C++SYCL_FPGA/Tutorials/GettingStarted/fpga_compile/part1_cpp/build$ cmake .. -DFPGA_DEVICE=Cyclone10gx
cmake: /home/tetto/intelFPGA_pro/23.1/quartus/linux64/libcurl.so.4: no version information available (required by cmake)
-- Ignoring FPGA_DEVICE: Cyclone10gx, not applicable
-- Configuring done
-- Generating done
-- Build files have been written to: /home/tetto/oneAPI-samples/DirectProgramming/C++SYCL_FPGA/Tutorials/GettingStarted/fpga_compile/part1_cpp/build

 

0 Kudos
BoonBengT_Intel
Moderator
2,933 Views

Hi @StefanoC,


Good to know that the emulation are successful, hence that should tell us that the required component/libraries might be correctly available.

As for the hardware compilation suspecting there might be some lower caps on the 'gx' which is causing some problem.

Would suggest to try with 'Cyclone10GX'.


If that does not work, maybe you can try with the full compilation command instead as below:

- icpx -fsycl -fintelfpga -DFPGA_HARDWARE -I../../../../include vector_add.cpp -Xshardware -Xstarget=Cyclone10GX -o vector_add.fpga


And for the hardware compilation from your end, is the build completed successfully with the bitsteam file generated? Is there a .prj folder generated?


Regards

BB


0 Kudos
StefanoC
Novice
2,898 Views

While the part1 works, I could compile and run it (although not without the make command but with the full command you shared), part2 does NOT work. Part1 is not interesting after all as it's the CPU that is doing the calculation, part2 is where I am mostly interested because the fpga does something. And interestingly enough the error I get is probably the very same I always had in the first place when I started this thread (PI_ERROR something..).

 

See below the issue with part2 (also the other abnormal thing is the cout that prints: "Running on device: SimulatorDevice" since given the compiler flag FPGA_HARDWARE it shouldn't say SimulatorDevice (unless something is wrong with the Cyclone10GX driver/oneAPI hardware support?

tetto@ubuntuoffice:~/oneAPI-samples/DirectProgramming/C++SYCL_FPGA/Tutorials/GettingStarted/fpga_compile/part2_dpcpp_functor_usm/src$ icpx -fsycl -fintelfpga -DFPGA_HARDWARE -I../../../../include vector_add.cpp -Xshardware -Xstarget=Cyclone10GX -o vector_add.fpga
aoc: Compiling for FPGA. This process may take several hours to complete.  Prior to performing this compile, be sure to check the reports to ensure the design will meet your performance targets.  If the reports indicate performance targets are not being met, code edits may be required.  Please refer to the oneAPI FPGA Optimization Guide for information on performance tuning applications for FPGAs.
tetto@ubuntuoffice:~/oneAPI-samples/DirectProgramming/C++SYCL_FPGA/Tutorials/GettingStarted/fpga_compile/part2_dpcpp_functor_usm/src$
tetto@ubuntuoffice:~/oneAPI-samples/DirectProgramming/C++SYCL_FPGA/Tutorials/GettingStarted/fpga_compile/part2_dpcpp_functor_usm/src$ ls -lrt
total 680
-rw-rw-r--  1 tetto tetto   3166 Feb  5 12:52 vector_add.cpp
-rw-rw-r--  1 tetto tetto   6348 Feb  5 12:52 CMakeLists.txt
drwxrwxr-x 11 tetto tetto   4096 Feb  7 21:06 vector_add.fpga.prj
-rwxrwxr-x  1 tetto tetto 679176 Feb  7 21:06 vector_add.fpga
tetto@ubuntuoffice:~/oneAPI-samples/DirectProgramming/C++SYCL_FPGA/Tutorials/GettingStarted/fpga_compile/part2_dpcpp_functor_usm/src$ ./vector_add.fpga
Running on device: SimulatorDevice : Multi-process Simulator (aclmsim0)
add two vectors of size 256
Caught a SYCL host exception:
Invalid device program image: size is zero -30 (PI_ERROR_INVALID_VALUE)
terminate called after throwing an instance of 'sycl::_V1::runtime_error'
  what():  Invalid device program image: size is zero -30 (PI_ERROR_INVALID_VALUE)
Aborted (core dumped)
tetto@ubuntuoffice:~/oneAPI-samples/DirectProgramming/C++SYCL_FPGA/Tutorials/GettingStarted/fpga_compile/part2_dpcpp_functor_usm/src$

 

0 Kudos
Reply