The first time an application calls REDCL::checkCompatability() the call can
take a long time, up to several minutes in some cases. This happens because
the OpenCL driver is compiling the RED kernels.

This can result in all OpenCL operations, not just from the R3D SDK, to be
blocked. Below is a list of steps to mitigate this delay and avoid the
appearance of the application hanging or processing to time out. 

Step 1: use the SDK’s compiled kernel cache folder feature. When instantiating
the REDCL class the second parameter to the constructor, compiledKernelCacheFolder,
should be set to a local non-temporary path. The SDK will store the compiled
kernels for the selected GPU in the specified folder and re-use them in the
future without needing to compile them again.

Step 2: pre-compile the kernels ahead of time using the same kernel cache
folder as step 1. To do this, instantiate the REDCL class pointing to the same
cache folder as in step 1 and call the checkCompatability() function on the
class instance to start the kernel compilation. The REDCL destructor will wait
for this process to finish. 

Due to this process potentially taking multiple minutes we recommend
indicating this caching is happening in your UI, so the user does not think
the application is hanging. This process will need to be repeated when the
user changes GPUs or the R3D SDK is updated. 

Some options to consider (more than one possible) when to run this:

  1) As part of the setup process when the user is installing the application.

  2) The first time the application is executed after installation. If any
     changes listed above happen this process should be repeated.

  3) Every time the application is executed as part of the application's
     initialization. Re-compilation will only happen if needed.

In SDK 8.6.0 a new InitializeSdk() flag was introduced: OPTION_DELAY_GPU_COMPILE

This flag does not pre-compile the OpenCL kernels when REDCL::checkCompatability()
is called, but does this on an as-needed basis. With modern GPU driver compilers
this can work well, in particular when used with the compiled kernel cache feature.