Hello! I need to distribute my program, which use opencl code without opencl sources. So i need to compile it to binary and load program from binary. This is simple, but each video card compile different binary for it self. How can i avoid this, and compile my source code for different videocards, whitout having this videocards. Maybe some compiler exist, where i can set spesific video card and get binary code for it? Thanks!
Hardcode the CL code into host binary, as a constant string? (it may seem a bit hacking but it will hide the code from user and while CL code is compiled with ‘clCreateProgramWithSource’ in such a case, it will compile and build online a program suitable to what machine the host application is working on, as far as I know)
I think what you need is SPIR,
the intermediate language between OpenCL source code and device-specific binary.
Now its specification compliant to OpenCL 1.2 has been released,
but the vendor support is still on its way.
please check the Khronos website for more details