Hi. I’m trying to learn OpenCL. I have a background in C/C++ and Java programming. I want to compile my project first just in gcc and test out the functions and then later I want to use the same code in OpenCL. It should be possible to have both C and OpenCL code in the same project since OpenCL uses C as the language. I can then specify with a precompiler flag that I want to use gcc or OpenCL kernel to run. This should be similar how I used to create both Linux and Windows executable from the same code base.
Is this actually possible? Is it even what I should be doing? Again, I just want to test my code with gcc and then at a later stage to run it in OpenCL.
Thank you for the reply. I actually already finished what I asked here. Using the clang compiler and the float2, float3, etc. extensions it was quite easy. I used a precompiler flag USE_OPENCL to have the (-almost- it’s actually the same code because the opencl_utils.h will act as a bridge) same code for both C and OpenCL. Now I can use the code base and test it with google-test using the clang compiler and then use OpenCL to run the kernel.