Results 1 to 4 of 4

Thread: Single float2 Output from OpenCL Kernel

  1. #1
    Junior Member
    Join Date
    Oct 2009
    Posts
    18

    Single float2 Output from OpenCL Kernel

    Is it possible to have an OpenCL kernel output a single (float2, float4 etc. ) value based on an analysis of an image?
    I must admit to being confused by how to specify input and output values for kernels, and haven't found a clear explanation.

    I'm sorry if this is such a stupid question...

    a|x
    http://machinesdontcare.wordpress.com

  2. #2
    Senior Member
    Join Date
    Jul 2009
    Location
    Northern Europe
    Posts
    311

    Re: Single float2 Output from OpenCL Kernel

    Kerenls can't return values. They are always defined with the void type. To return values you can simply create a cl_mem object and write to it. The only tricky part is figuring out which work-item does the writing, since you will presumably have many work-items working together.

  3. #3
    Junior Member
    Join Date
    Oct 2009
    Posts
    18

    Re: Single float2 Output from OpenCL Kernel

    Thanks for the reply.

    I'm writing OpenCL kernels in Apple's Quartz Composer, so don't have full access to the way OpenCL is setup in the background. I'll try and find out more from the QC devlist.

    Thanks a lot,

    a|x

  4. #4
    Senior Member
    Join Date
    Jul 2009
    Location
    Northern Europe
    Posts
    311

    Re: Single float2 Output from OpenCL Kernel

    You can do this in quartz composer but you may have to turn on the advanced options. Basically you need to define an output that's of size 2 to get 2 floats out from quartz composer. It will then generate a global float* output and you can write to output[0] and [1].

Similar Threads

  1. Kernel always returns the same array of single value
    By fizzlesticks23 in forum OpenCL
    Replies: 1
    Last Post: 04-05-2013, 06:45 AM
  2. Returning a single value from kernel!
    By Atmapuri in forum OpenCL
    Replies: 1
    Last Post: 05-10-2011, 04:08 AM

Posting Permissions

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