Question

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!

Was it helpful?

Solution

SPIR is designed for this http://www.khronos.org/registry/spir/

At least AMD cards support it. But you cannot use that in general right now.

Right now there is really no other way than just providing the kernels as text with your program if you want to distribute it generally to consumers. I wouldn't worry too much about the kernels being visible. Without the OpenCL API calls and documentation they are simply useless. It takes more time for someone to reverse-engineer them than to do the same from scratch. It's like OpenGL shaders in games which also are in raw text format.

OTHER TIPS

SPIR is the solution,

just for a work around the following is the solution

I think the binary will be same for a particular type of video cards. you can store the binaries of all the different video cards and choose the proper binary during the runtime using the Device information.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top