Results 1 to 2 of 2

Thread: arguments to kernel functions

  1. #1
    Junior Member
    Join Date
    Apr 2010
    Posts
    1

    arguments to kernel functions

    Can I pass to kernel function pointer to structure like this:
    Code :
    structure My {
        int x1;
        int x2;
        my_structure_type1 *ps1;
        my_structure_type2 *ps2;
    }
    where my_structure_type1 and my_structure_type2 are my own defined types from other structures.

  2. #2
    Junior Member
    Join Date
    Feb 2010
    Posts
    5

    Re: arguments to kernel functions

    Hi,

    I am not sure if I understand you correctly, but if you have situation, where you fill the variable of My structure with data on host(your program using OpenCL) and then you pass this struct (or pointer to it) via buffer to kernel like this:
    __kernel void myKernel(__global My* myVar)
    {
    ...
    }
    ...then the pointer members of My structure (ps1, ps2) will still contain address which points somewhere to host memory, while the kernel is (I presume) executed on GPU, in completely different address space.

    I remember getting myself into similar trap, resulting in various side effects like freezing up the PC.

    So, in my opinion it is not possible to do it this way.


    Petr

Similar Threads

  1. Vectors and kernel arguments
    By billy124 in forum OpenCL
    Replies: 0
    Last Post: 08-07-2012, 07:47 PM
  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
  •