PDA

View Full Version : Compilation of the Kernel is always at runtime?



luizdrumond
07-18-2011, 02:32 PM
Hi,
In my application, in a certain problem the time of kernel compilation is eighty percent of the time of all execution.
And, some references say that compilation of kernel is always in runtime of application. So, every time that i execute my application, the kernel is compiled.
There some ways that i compile my kernel a only time?

Thanks,

david.garcia
07-19-2011, 04:36 PM
Yes, there is a very simple way. After building your program with clBuildProgram() you can retrieve the prebuilt program binary with clGetProgramInfo (http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clGetProgramInfo.html)(..., CL_PROGRAM_BINARIES, ...)

Next time your program runs, you can use that precompiled binary and load it with clCreateProgramWithBinary() (http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clCreateProgramWithBinary.html) instead of using clCreateProgramWithSource(). It should be quite a bit faster than recompiling from source.