Results 1 to 2 of 2

Thread: Asynchrouous call to program build

  1. #1

    Asynchrouous call to program build

    Hi,

    I want to know if i do non-blocking call to clbuildprogram and then upload data ,enqueue kernel does it work ?
    Ex:

    create context
    creeat queue
    buildprogram
    ...
    ...
    ...
    upload data

    enqueue kernel

    clfinish


    Thanks
    Manish

  2. #2
    Junior Member
    Join Date
    Jan 2012
    Posts
    5

    Re: Asynchrouous call to program build

    Hi Manish,

    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...)

Similar Threads

  1. Program Build Error
    By dlw in forum OpenCL
    Replies: 5
    Last Post: 06-28-2011, 12:34 PM
  2. Asynchronous build program
    By matrem in forum OpenCL
    Replies: 1
    Last Post: 04-13-2010, 04:01 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •