View Full Version : Asynchrouous call to program build
08-31-2012, 07:52 AM
I want to know if i do non-blocking call to clbuildprogram and then upload data ,enqueue kernel does it work ?
09-09-2012, 12:50 AM
It might - if enough time had passed between calling to clBuildProgram and clCreateKernel - but I wouldn't count on it.
In order to enqueue the kernel, you need a kernel handler - which means that you need to call clCreateKernel with the program handler. The call to clCreateKernel will fail if the program did not finish building, returning CL_INVALID_PROGRAM_EXECUTABLE (see page 158 in OpenCL 1.2 spec).
If you want call clBuildProgram asynchronously, and ensure that it finished building before calling clCreateKernel, you need to register a callback function. This function will be called when the compilation is done - and inside the typical method is to set a semaphore. The application thread will wait on the semaphore before calling clCreateKernel . of course, you can use other methods (state variable, reference counter, etc...)
Powered by vBulletin® Version 4.2.2 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.