Intel® Quartus® Prime Software
Intel® Quartus® Prime Design Software, Design Entry, Synthesis, Simulation, Verification, Timing Analysis, System Design (Platform Designer, formerly Qsys)
16606 Discussions

Run OpenCL kernel on two heterogeneous devices.

hamze60
New Contributor I
2,063 Views

Hello,

As I read in the programming-guide, it seems that it is possible to have 2 parallel heterogeneous devices (such as two separate FPGA boards) to run a single kernel. I guess in that case some work-items run on one device, and others on the second one... Anyway, I do not have 2 FPGA boards. My question is:

 

is it possible to use host processor as 2nd device beside FPGA? I work on Xeon+FPGA harp machine, which has a FPGA connected to host processor. I can manually partion my problem and run some part of it on FPGA and other part on host processor. But if Altera's OpenCL can support it, that is very easier (I guess by standard heterogeneous devices is supported).

 

@HRZ​  I appreciate if you can take a look. You helped a lot in before issues.

Thank you very much.

 

 

0 Kudos
3 Replies
HRZ
Valued Contributor III
455 Views

Sorry for the late reply, I was locked out of my account and restoring it took a while.

 

Anyway, if you want to use the host CPU alongside with the FPGA, even though you can also use the CPU as a second OpenCL device, it is likely not the best solution. The main problem will be that if you compile your host code using the Intel OpenCL compiler for FPGAs, the host code will never see your CPU as an OpenCL device. However, if your board manufacturer provides an ICD driver in the BSP, you can compile the host code with Intel's OpenCL compiler for CPUs or AMD's OpenCL compiler and then you can get both the FPGA and the CPU detected. Of course you might lose some functionality specific to FPGAs by using such compilers. What I would do instead is that I would run standard C/C++ code in the host code on the CPU, probably parallelized using MPI or OpenMP, and only use OpenCL for the FPGA. Remember that all OpenCL functions are non-blocking (or have an option for it) and hence, you can easily run C/C++ code on the CPU in parallel with running OpenCL code on the FPGA. You can then use OpenCL events to synchronize the functions running on the two devices.

 

If, however, you want to use two different FPGA boards, it would depend on whether they belong to same manufacturer or not. If they do, you can easily use them as separate devices since they will be likely using the same PCI-E driver and OpenCL headers. However, for two FPGA boards from different manufacturers, things could get tricky. Again you will likely need to use a compiler different from Intel's OpenCL compiler for FPGAs and have ICD drivers for both boards. Even in that case, you might have trouble getting the boards to work simultaneously due to conflict between the PCI-E drivers of the different manufacturers.

 

Information on this topic is scarce in the documentation and what I said above is based on my limited experience. I am also still using old versions of the compiler (16.1.2); things might have improved in the newer versions.

0 Kudos
hamze60
New Contributor I
455 Views

Thank you!

Actually I already have a software golden model to compare with my OpenCL result. The software is almost very similar to OpenCL code, and I also accelerate it with OpenMP.

 

However, as I wrote, I wanted to have it in an OpenCL style, to have a comparison (for academic paper) between FPGA OpenCL and CPU OpenCL. Sometimes I want to divide my problem on multiple devices, including FPGA and CPU. If intel OpenCL for FPGA, does not support this directly inside same tool, I think I need to use intel's another tool https://software.intel.com/en-us/intel-opencl

I will test it in 1-2 days to see.

0 Kudos
HRZ
Valued Contributor III
455 Views

I see. The last time I tried no OpenCL devices other than the FPGA could be detected when compiling the host code using the Intel FPGA headers. You can try installing Intel's OpenCL Runtime for CPUs and see if the CPU gets detected wiht a host code compiled against the FPGA headers. If not, you will likely have to compile your host code against another OpenCL SDK.

0 Kudos
Reply