source-to-source translation of c source code

I have not used the PGI forums in over a year. I am curious about something that I saw in another post by another user.

Is it possible to used one of the compilers available in the CUDA workstation package to perform a source-to-source translation of say ANSI c code to OpenCL.

I am specifically thinking about porting c source code to an field programmable gate array (FPGA). Some FPGA now can compile openCL not just Verilog or VHDL.

Any help appreciated. Thanks in advance.


THX 1138

Hi THX 1138,

While you can keep the intermediary OpenCL file generated by using OpenACC directives, I don’t know if it will help you in this project. The details on how OpenACC is translated to the target device is intended to be invisible to the user and may change. For example, in 15.1 we switched from using OpenCL to LLVM by default for Radeon targets.

You can certainly try, however. You can get the OpenACC intermediate OpenCL file by targeting a Radeon and add the flags “nollvm” and “keep”

  • Mat