Loading Offline Kernel binary

Hello,
I have read two articles about how to generate and load kernel binary.

First article is in knowledge base, saying:
Loading A Generated Binary Kernel

  1. Call clBuildProgram() to setup the necessary internal program state.
err = clBuildProgram( program, 1, &device_id, NULL, NULL, NULL );

Can you explain why this is needed?

In the second article:
http://www.fixstars.com/en/opencl/book/OpenCLProgrammingBook/online-offline-compilation/
in this section:
List 4.7: Offline compilation - Reading the kernel binary
there is written something different see point 2.:

		(const unsigned char **)&binary_buf, &binary_status, &ret);

with a note:
To summarize, in order to change the method of compilation from online to offline, the following steps are followed:

  1. Read the kernel as a binary
  2. Change clCreateProgramWithSource() to clCreateProgramWithBinary()
  3. Get rid of clBuildProgram()

So this is confusing. Once being said we need to call clBuildProgram and second time said we don’t need it. Both cases are for loading kernel binary. So can you please explain why I need it or do not need it?

Here is my code I am working on:
http://pastebin.com/dFkPRhVb

clBuildProgram is required regardless of whether you created the program using clCreateProgramWithSource or clCreateProjectWithBinary. It will be faster with binary sources.