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$