Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
10 years ago

Program FPGA with multiple different kernels in parallel

I'd like to be able to run multiple kernels with different operations at the same time using the CycloneV SoC (DE1-SoC). Can you guys check if my understanding is correct:

  1. It's possible to compile multiple different kernels into the same aocx file

  2. How are these kernels called from the host side? Do I just duplicate the relevant OpenCL API calls like clCreateProgramWithBinary, clBuildProgram, clCreateKernel, clEnqueueNDRangeKernel, etc. for each kernel?

  3. For point# 2 above (duplicating the API calls), does it program the FPGA once with all the kernels so they can be run at the same time? Or does the FPGA get programmed with the first kernel, run the first kernel, then reprogram with the second kernel, run the second kernel, and so on?

  4. If I use `aocl flash` to load the aocx image into the FPGA, the FPGA will automatically be programmed with my kernels upon startup and I won't need to reprogram the FPGA with clCreateProgramWithBinary in my host program. Is that right?

Are there are any example projects where multiple different kernels are programmed together into the FPGA and executed at the same time? If so, I would appreciate a link to it.

Thanks!

2 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    1. Yes.

    2. You only need to create and build program once per .aocx file. You do need to create and enqueue each of the kernel separately, however.

    3. The .aocx file contains the entire image for the FPGA, which includes all the kernels written in the .cl source code file. You don't need to reconfigure FPGA for different kernels.

    4. Not sure how you can skip clCreateProgramWithBinary. Without calling this function you can not get the program object or kernel object, which is necessary for the clEnqueueNDRangeKernel. Flash tool is usually slower than the host program anyway, so not sure how this could be beneficial to you.

    Multiple Altera AOCL Examples used concurrent kernel launch. Look for the one that demonstrated use of channel.

    Hope that helps.

    Ryan
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    ok thanks Ryan, that answers my questions.

    I also downloaded the video downscaling example from the AOCL examples page and it's a pretty good demonstration of how the host side API works for multiple kernels.