That’s not what that post/answer says. That post (i.e. the answer) is not doing anything like “offline compilation” and no functionality in that post is deprecated AFAIK. The answer there should continue to work fine with today’s nvcc
, but it is not doing offline compilation as described in chapter 4 of the book you reference, which seems to be available here. Furthermore, the offile compilation example described in that chapter assumes that the kernel binary is already compiled and stored on a disk file. Other than block diagrams, it gives no hint of what tools to use, that I can see, to do the offline compilation portion.
I’m not aware of any tool from NVIDIA that does offline compilation for OpenCL kernel code. The relevant quote from the chapter 4 you reference is here:
In fact, a stand-alone OpenCL compiler is not available for the OpenCL environment by NVIDIA, AMD, and Apple. Hence, in order to create a kernel binary in these environments, the built kernels has to be written to a file during runtime by the host program.
(emphasis added)
I’m not aware of any change to that statement as far as NVIDIA is concerned.
However, the suggestion there might be possible. You could use the online version code provided there, perhaps up to (but not including) the call of clCreateKernel
, then find a way to write the built program to disk. Then, as in the offline version, load that from disk and call clCreateKernel
and continue. I wouldn’t be able to explain how to do that fully, however. The method doesn’t seem that it would be in any way unique or specific to the NVIDIA toolchain.
You could ask a nice targetted question in an OpenCL forum like
“After the call to clBuildProgram
, how do I write the built program to a disk file?”
Again, doesn’t seem to be in any way specific to NVIDIA. But once you have that info, you should be able to try doing “offline compilation” as I described.