Results 1 to 5 of 5

Thread: pass pointer arguments to non-kernel function in deivice

  1. #1
    Junior Member
    Join Date
    Mar 2012
    Posts
    3

    pass pointer arguments to non-kernel function in deivice

    Hello,
    I try to build a simple OpenCL program for a lesson I have. I've done a little search but I haven't figured out yet how to procceed. So my problem is this:

    I want to have 2 functions in the device, one kernel that calls the other one that is not kernel. The thing is I want to pass pointer arguments, but I read that this is not possible.

    Code :
    __kernel void kernel_func(__global double *startpt, __global double *endpt) {
       //something with startpt
       normal_func(endpt);
    }
     
    double normal_func(double *endpt){
       for(i = 0; i < 8; i++) endpt[i] = 1;
    }

    Also, I would prefer to have endpt as private to each thread and in the end of kernel_func perform a reduction by minimum to some of the values of endpt and return to device the endpt of one thread.
    Any help would be appreciated. Even links.

  2. #2
    Senior Member
    Join Date
    Aug 2011
    Posts
    271

    Re: pass pointer arguments to non-kernel function in deivice

    Really? Where did you read such nonsense?

    You should check the compiler error on this code, it should point you in the right direction. The types are just wrong, you need to include the address space qualifiers (global/local/etc) as well.

  3. #3
    Junior Member
    Join Date
    Mar 2012
    Posts
    3

    Re: pass pointer arguments to non-kernel function in deivice

    My mistake. I found the solution. I couldn't understand why i can't pass a __global pointer to a non __global. Now i do

    Thanks for the help, Mr. notzed

  4. #4
    Junior Member
    Join Date
    Apr 2012
    Posts
    1

    Re: pass pointer arguments to non-kernel function in deivice

    I am also stuck on this. Could you please post the solution that you found?

  5. #5
    Junior Member
    Join Date
    Mar 2012
    Posts
    3

    Re: pass pointer arguments to non-kernel function in deivice

    Sorry I forgot to check the thread twice. Are you still interested in an answer or you saw through your problem?

Similar Threads

  1. Replies: 8
    Last Post: 02-08-2012, 03:51 AM
  2. Not having functions return values via pointer arguments
    By PaulS in forum Suggestions for next release
    Replies: 2
    Last Post: 10-15-2009, 05:11 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
  •