Forum Discussion

zjinf's avatar
zjinf
Icon for Occasional Contributor rankOccasional Contributor
7 years ago

How to use modelsim simulation openCL kernel ???

I running openCL kernel function on Arria 10gx board successfully!

now i want to simulation the kernel by by modelsim ! how can i do this ??

or any hint ?

8 Replies

    • zjinf's avatar
      zjinf
      Icon for Occasional Contributor rankOccasional Contributor

      Hi Musman

      Thanks for your reply ! that is not what i want!

      i want simulation my own kernel , not the .*libraries*

      take vector add for example:

      _kernel void vector_add(__global const float *x,

      __global const float *y,

      __global float *restrict z)

      {

      // get index of the work item

      int index = get_global_id(0);

      // add the vector elements

      z[index] = x[index] + y[index];

      }

      It must have related RTL code for the kernel ! where is the code ? intel not provide the code ? thanks again

  • HRZ's avatar
    HRZ
    Icon for Frequent Contributor rankFrequent Contributor

    @MUsman​ That is for OpenCL *libraries* (i.e. HDL code), not standard OpenCL kernels.

    @zjinf​ Intel does not provide such functionality as far I am aware. You can do functional simulation in software for OpenCL kernels, but there is no way that I know of for timing-accurate simulation of OpenCL kernels.

    • zjinf's avatar
      zjinf
      Icon for Occasional Contributor rankOccasional Contributor
      1. "You can do functional simulation in software for OpenCL kernels" how could i do this ?
      2. in my project directory, i open the Quartus prime Pro Edition software, i want open my project by quartus prime to view the whole system including kernel and memory controller and pcie controller and other module RTL structure ! how to do ?? or any document can refer ?

      HRZ thank you for your help !

      • HRZ's avatar
        HRZ
        Icon for Frequent Contributor rankFrequent Contributor
        1. If you don't use any FPGA-specifc constructs (e.g. on-chip channels), you can run and debug your code on any other OpenCL-capable device (CPU/GPU) in the same way as you would debug any other C/C++ code. You can also use Intel's emulator (which also works with channels, etc). Please refer to "Intel FPGA SDK for OpenCL Pro Edition Programming Guide, Section 8. Emulating and Debugging Your OpenCL Kernel" for more information.
        2. Open the "top.qpf" from the folder that is created by aoc. Running aoc -c (aoc -rtl in newer versions) is enough for this step.
  • zjinf's avatar
    zjinf
    Icon for Occasional Contributor rankOccasional Contributor

    Hi HRZ

    Thank you for your help!

    Yes, i have try open the "top.qpf" quartus project , and try to view the RTL Viewer , but it need to compile the project , while compile the "top.qpf"project, it generate many many error as following:

    This kind error must be the quartus software compatible with the aoc command ! how could i fix the error ??(without compile the "top.qpf", it can't generate RTL level viewer)

  • HRZ's avatar
    HRZ
    Icon for Frequent Contributor rankFrequent Contributor

    Considering the fact that Quartus is complaining about missing files, maybe -c (-rtl) is not enough to generate all the HDL system. You can try compiling completely once with aoc and then opening the project with Quartus to make sure all the OpenCL system is created already.

  • Hi, Please update OpenCL SDK to 19.1 and try running simulation as suggested in OpenCL programming guide. https://www.intel.com/content/dam/www/programmable/us/en/pdfs/literature/hb/opencl-sdk/aocl_programming_guide.pdf Page : 172 Topic: Compiling a Library for Simulation (-march=simulator) " To compile a simulation that targets a specific board, invoke the aoc -march=simulator -ghdl -board=<board_name> <your_kernel_filename>.cl command " OpenCL examples are tested with this flow and are updated with commands in respective README file. You can also take example of Vector add or Hello world example as described in README.html file in OpenCL SDK 19.1 installation directory. <OpenCL 19.1 SDK installation directory>\examples_aoc\vector_add\README.html Thanks, Arslan